You might try something like:
Remove the "echo " in all three places it occurs if you're convinced that this does what you want.
This creates empty files instead of files containing a "0" for file12.dat and any other missing files in the given directories. If you really want a file containing "0" (with no trailing <newline>), replace both touch $target commands with printf "0" > $target. If you want a more complicated initialization file, create it as a file named initfile.dat in the directory where this script will be started and replace the touch commands with cp "$basedir"/initfile.dat $target commands. If you want to be able to run this when you aren't sitting in the base directory for this file hierarchy, add cd rootdir(where "rootdir" is an absolute pathname to the desired starting point) before the line that sets basedir.
Hi there,
I hope someone can help me with this problem :
I have a directory (/var/www/file/imgprofil) which contains about 10000 JPG files. They have a naming convention thus :
prefix-date-key-suffix.jpg
they all have the prefix p-20050608-
then AAAA is a 4 letter code
the suffix is... (7 Replies)
Well the title is not too good, so I will explain.
I need to move (rename) files using a simple AIX script.
???file1.txt
???file2.txt
???file1a.txt
???file2a.txt
to be:
???renamedfile1'date'.txt
???renamedfile2'date'.txt
???renamedfile1a'date'.txt
???renamedfile2a'date'.txt
... (4 Replies)
I am new at Linux/UNIX programming. Here is my problem.
I had one big file which I split using the command
csplit -k -s -f april.split. april '/^ISA/' '{10000}'
So now I have multiple files with names
april.split.01
april.split.02
april.split.03
But I need the name of the file like... (5 Replies)
Dear All,
Please help !
i ham having 300 file with E.G. PMC1_4567.arc in seq. like PMC1_4568.arc,PMC1_4569.arc ...n and so on.. i want all those file to be rename like PMC_4567.arc ,PMC_4568.arc .. mean i want to remove 1 from first file name ..
pls help.. (6 Replies)
Okay so here's something that's confusing me: I have a script that's designed to remove the words "new_" from the front of any file except two exceptions and it looks something like this...
for i in new_*
do
if ] && ]; then
j=`echo "$i"|cut -c5-`
mv $i $j
fi
done
... (5 Replies)
I hope some one can help me
I have multiple files in a directory with out extension like as below mentioned. But i want to change all the file names along .DDMMYYYYHHMISS format. And all files should have same DDMMYYYYHHMISS.
Scenario:
direcory name = /vol/best/srcfiles
files in a... (4 Replies)
hi im new to linux and was just wondering if some 1 could help me
i have folders with T.V. series in them and i would like to delete part of the filename
e.g.
(series name).s01e01.(episode name)
(series name).s01e02.(episode name)
(series name).s01e03.(episode name)
(series... (4 Replies)
All,
I wanted to copy the files
From:
Daily_XYZ_TEST_1.csv
Daily_XYZ_TEST_2.csv
Daily_XYZ_TEST_3.csv
Daily_XYZ_TEST_4.csv
To:
Daily_ABC_TEST_1.csv
Daily_ABC_TEST_2.csv
Daily_ABC_TEST_3.csv
Daily_ABC_TEST_4.csv
I have tried the rename command but it is not working (5 Replies)
Hey guys, I am the definition of a newbie. I am in the process of trying to rip all my dvds onto a new HTPC I setup. While doing this, I am also trying to organize a bunch of other files I already have to proper naming conventions. So far I have just been naming each file separately (I am on a... (4 Replies)
Hi all,
I need to rename more file name in one command or script.
The files have this structure:
XxY - filename.doc
where X and Y are numbers and the x is the letter itself.
I need to rename these files with this structure:
string.S0XEY.filename.doc
the string is a suffix that... (8 Replies)
Discussion started by: idro
8 Replies
LEARN ABOUT HPUX
rename
rename(2) System Calls Manual rename(2)NAME
rename - change the name of a file
SYNOPSIS DESCRIPTION
The system call causes the source file to be renamed to target. If target exists, it is first removed. Both source and target must be of
the same type (that is, either directories or nondirectories), and must reside on the same file system.
If target can be created or if it existed before the call, guarantees that an instance of target will exist, even if the system crashes in
the midst of the operation.
If the final component of source is a symbolic link, the symbolic link is renamed, not the file or directory to which the symbolic link
points.
RETURN VALUE
returns the following values:
Successful completion.
Failure.
Neither file is affected. is set to indicate the error.
ERRORS
If fails, is set to one of the following values.
[EACCES] A component of either path prefix denies search permission.
[EACCES] The requested link requires writing to a directory without write permission.
[EBUSY] target or source is an existing directory that is the mount point for a mounted file system.
[EDQUOT] User's disk quota block or inode limit has been reached for this file system.
[EEXIST] target is a directory and is not empty.
[EFAULT] source or target points outside the allocated address space of the process. Reliable detection of this error is
implementation dependent.
[EINVAL] source is a parent directory of target, or an attempt is made to rename the or directory.
[EISDIR] target is a directory, but source is not.
[ELOOP] Too many symbolic links were encountered in translating either path name.
[ENAMETOOLONG] A component of either path name exceeds bytes while is in effect, or the entire length of either path name exceeds
bytes.
[ENOENT] A component of the source path does not exist, or a path prefix of target does not exist.
[ENOSPC] The destination directory cannot be extended because of a lack of space on the file system containing the directory.
[ENOTDIR] A component of either path prefix is not a directory.
[ENOTDIR] source is a directory, but target is not.
[EPERM] The directory containing source has the sticky bit set, and neither the containing directory nor the source are owned
by the effective user ID.
[EPERM] The target file exists, the directory containing target has the sticky bit set, and neither the containing directory
nor the target are owned by the effective user ID.
[EROFS] The requested link requires writing in a directory on a read-only file system.
[EXDEV] The paths named by source and target are on different logical devices (file systems).
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO open(2).
STANDARDS CONFORMANCE rename(2)