| rename | system | rename |
rename -- rename a file or set of files
rename file newname
Rename 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 newname is a directory or field 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 newname 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 newname is a directory if the value of field is "all", otherwise an error is generated to prevent overwriting files.
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
movefiles, copy