10.0;chn (change_name), revision 1.0, 88/01/21
chn (change_name) -- Change an object's name.
usage: chn old_name [new_name] [-p] [-d | -y] [-u] [-s] {CL}
DESCRIPTION
chn changes the name of a file, directory, or link. chn works with the
rightmost component ("leafname") of the old name (see EXAMPLES).
You cannot use chn to change the name of a directory embedded in a
complete pathname, if doing so would relocate the file. to some other
part of the naming tree. For instance,
$ chn //et/mary/letters //et/fred/letters
is illegal. Use the mvf (move_file) command for that operation.
Multiple old_name/new_name pairs and pathname wildcarding are permitted.
ARGUMENTS
old_name (required)
Specify the current pathname of the object to be renamed.
new_name (optional)
Specify the new name of the object. The new name may be
derived from the old name. new_name may be omitted
entirely if -d, -y,or -u are specified. Otherwise, some
portion of it is required. Names may be 1 to 32 characters
long.
Default if omitted: derive new_name from old_name
OPTIONS
-p[airwise]
Instructs chn to accept the list of tokens as consecutive pairs.
This is necessary whether you are using wildcards or not.
-d Append today's date (month and day) to new_name in the form
new_name.mm.dd
-y Append today's date (year, month, and day) to new_name in the form
new_name.yy.mm.dd
-u Force new_name to be unique by appending a sequence number to the
end of the name until it becomes unique.
-s List names changed on standard output.
NOTES
If you use more than one pair of name tokens with this command, you must
use the -p option. It instructs the command to accept the list of tokens
as consecutive pairs. This is necessary whether you are using wildcards
or not. In the past, this command has correctly paired off tokens without
the prompting of a switch; now the -p switch must be used to acheive this
result. The switch has been added to protect against inadvertent use in
a shell, other than /com/sh, where wildcard expansion can be a problem.
EXAMPLES
Change the name fritz to henri in the current working directory.
$ chn fritz henri
Change henri to mike and peter to paul.
$ chn henri mike peter paul
Change a, b, and c to a.zorp, b.zorp, and c.zorp.
$ chn (a b c) =.zorp
Change the file projects to new_projects in the directory /my/stuff.
$ chn /my/stuff/projects new_projects
Change henri to henri.mm.dd where mm is the current month (01-12) and
dd is the current date (01-31).
$ chn henri -d
henri.07.19
Change joe by appending sequence number to end of filename.
$ chn joe -u
joe.1