blob: 226045daf724aa3931873b6e6c3e1a04af03ae52 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
.help rename Aug97 system
.ih
NAME
rename -- rename a file or set of files
.ih
USAGE
rename file newname
.ih
PARAMETERS
.ls file
A template specifying the file or files to be renamed.
.le
.ls newname
If a single file is being renamed, the new filename, else the new name of
the field being renamed in a set of filenames. If \fInewname\fR is a
directory the input files will be moved to this directory with the same
name.
.le
.ls field = all
If set to "all" the file name remains unchanged and the \fInewname\fR is
assumed to be a destination directory in the case of multiple input files,
or the new filename (which may contain a new directory path) in the case of
a single input file. If set to \fIldir\fR the \fInewname\fR value is taken
to be a destination directory and the file is moved to this directory.
Setting to \fIroot\fR will rename only the root portion of the filename,
a value of \fIextn\fR will change or append the extension. \fInewname\fR
cannot contain a directory path when changing the root or extn field.
.le
.ih
DESCRIPTION
\fIRename\fR renames either a single file to "newname", or a set of files,
changing either the ldir, root or the extension part of each name.
If \fInewname\fR is a directory or \fIfield\fR is "ldir" the input files
are moved to this directory and the filenames remain the same. When
modifying the root or extension part of the filename \fInewname\fR is the
new root or extension name for the input files, an extension will be added
to the file name if it doesn't already exist and the extension field is being
modified. For multiple input files it is assumed
that \fInewname\fR is a directory if the value of \fIfield\fR is "all",
otherwise an error is generated to prevent overwriting files.
.ih
EXAMPLES
1. Rename file "fred" to "jay".
cl> rename fred jay
2. Change the root name of a set of files from "out" to "pkout".
cl> rename out.x,out.o,out.par pkout field=root
3. Change the extension of all ".f77" files from ".f77" to ".f".
cl> rename *.f77 f field=extn
4. Move all files with a ".dat" extension to a new directory.
cl> rename *.dat data$
cl> rename *.dat /data/user
5. Add a ".fits" extension to all files in a directory.
cl> rename im00* fits field=extn
.ih
BUGS
.ih
SEE ALSO
movefiles, copy
.endhelp
|