REN - Rename files or subdirectories
Purpose: Rename files or subdirectories.
Format: REN [/A:[[-]rhsda] /E /N /P /Q /S /T] old_name ... new_name
or
RENAME [/A:[[-]rhsda] /E /N /P /Q /S /T] old_name ...
new_name
old_name : Original name of the file(s) or subdirectory.
new_name : New name to use, or new path on the same drive.
/A: (Attribute select) /Q(uiet)
/E (No error messages) /S(ubdirectory)
/N(othing) /T(otal)
/P(rompt)
See also: COPY and MOVE.
File Selection
Supports extended wildcards, ranges, multiple file names, and include
lists.
Usage
REN and RENAME are synonyms. You may use either one.
REN lets you change the name of a file or a subdirectory, or move one or
more files to a new subdirectory on the same drive. (If you want to move
files to a different drive, use MOVE.)
In its simplest form, you give REN the old_name of an existing file or
subdirectory and then a new_name. The new_name must not already exist --
you can't give two files the same name (unless they are in different
directories). The first example renames the file MEMO.TXT to MEM.TXT.
The second example changes the name of the \WORD directory to \WP :
[c:\] rename memo.txt mem.txt
[c:\] rename \word \wp
If you use REN to rename a directory, the extended directory search
database will be automatically updated to reflect the change.
When you rename files on an HPFS drive, you must quote any file names
which contain whitespace or special characters. See File Names for
additional details.
You can also use REN to rename a group of files that you specify with
wildcards, as multiple files, or in an include list. When you do, the
new_name must use one or more wildcards to show what part of each
filename to change. Both of the next two examples change the extensions
of multiple files to .SAV :
[c:\] ren config.sys autoexec.bat 4start.btm *.sav
[c:\] ren *.txt *.sav
REN can move files to a different subdirectory on the same drive. When
it is used for this purpose, REN requires one or more filenames for the
old_name and a directory name for the new_name :
[c:\] ren memo.txt \wp\memos\
[c:\] ren oct.dat nov.dat \data\save\
The final backslash in the last two examples is optional. If you use it,
you force REN to recognize the last argument as the name of a directory,
not a file. The advantage of this approach is that if you accidentally
mistype the directory name, REN will report an error instead of renaming
your files in a way that you didn't intend.
Finally, REN can move files to a new directory and change their name at
the same time if you specify both a path and file name for new_name. In
this example, the files are renamed with an extension of .SAV as they are
moved to a new directory:
[c:\] ren *.dat \data\save\*.sav
You cannot rename a subdirectory to a new location on the directory tree.
REN does not change a file's attributes. The new_name file(s) will have
the same attributes as old_name.
Options
/A:: (Attribute select) Select only those files that have the
specified attribute(s) set. Preceding the attribute character
with a hyphen [-] will select files that do not have that
attribute set. The colon [:] after /A is required. The
attributes are:
R Read-only
H Hidden
S System
D Subdirectory
A Archive
If no attributes are listed at all (e.g., REN /A: ...), REN will select
all files and subdirectories including hidden and system files. If
attributes are combined, all the specified attributes must match for a
file to be selected. For example, /A:RHS will select only those files
with all three attributes set. /E:(No error messages) Suppress all
non-fatal error messages, such as "File Not Found." Fatal error
messages, such as "Drive not ready," will still be displayed. This
option is most useful in batch files. /N:(Nothing) Do everything except
actually rename the file(s). This option is useful for testing what a
REN command will actually do. /P:(Prompt) Prompt the user to confirm each
rename operation. Your options at the prompt are explained in detail
under Page and File Prompts. /Q:(Quiet) Don't display filenames or the
number of files renamed. This option is most often used in batch files.
See also /T. /S:(Subdirectory) Normally, you can rename a subdirectory
only if you do not use any wildcards in the new_name. This prevents
subdirectories from being renamed inadvertently when a group of files is
being renamed with wildcards. /S will let you rename a subdirectory even
when you use wildcards. /S does not cause REN to process files in the
current directory and all subdirectories as it does in some other file
processing commands. To rename files throughout a directory tree, use a
GLOBAL REN. /T:(Total) Don't display filenames as they are renamed, but
report the number of files renamed. See also /Q.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs