RENAME
This page was last modified 14:25, 1 June 2020 by Mars2000you. Based on work by Gdx.

Contents

Effect

Renames one or more files.

If for some reason a particular file cannot be renamed (eg. if a file or directory with the new name already exists) then

  • under MSX-DOS 1: the message 'Rename errror" will be displayed
  • under MSX-DOS 2 / Nextor:the offending filename will be printed along with an error message and the rename operation will continue with the next file

Syntaxes

Under MSX-DOS 1

RENAME <Device>:<Filename> <NewFilename>

Note: RENAME can be replaced by REN

Under MSX-DOS 2 / Nextor

RENAME /S /H /P <Device>:\<Path\<Filename> + <Device>:\<Path>\<Filename>... <NewFilename>

Notes:

  • RENAME can be replaced by REN
  • RENAME has been removed in versions 2.40 to 2.43, you can only use REN with these MSX-DOS 2 versions
  • Character backslash (\) serves as a separator between the folders and the file name in MSX-DOS2. You don't have to put it after the colon of the device name. Backslash is replaced by the character yen (¥) on Japanese MSX or the character won (₩) on Korean MSX.
  • Character slash (/) serves to declare an option. You can put the options after the command or behind all other parameters.

Parameters

<Device> is the name for used device. It can only be a disk drive.

If you don't specify the drive, the computer will delete file(s) on the currently active drive (by default, it's drive A:)

Device type Device name Remark
Disk drive A, B, C, D, E, F, G, H A floppy disk interface can control until 2 drives.


<Path> is used to specify the location in folders of file to rename. Each folder name in path are separate by a backslash (\). This parameter is only available under MSX-DOS 2 / Nextor.

<Filename> is the file name to rename. Wildcards can replace some characters in filename to get several files. The asterisk (*) and question mark (?) are used as wildcard characters. The asterisk matches any sequence of characters, whereas the question mark matches any single character.

<NewFilename> is the new file name to apply. Wildcards can replace some characters in filename to get several files. The asterisk (*) and question mark (?) are used as wildcard characters. The asterisk matches any sequence of characters, whereas the question mark matches any single character.

File names are in the format 8 characters followed by a point and an extension with 3 characters. They need to be different and the new file name can't already be used for another file on the disk inserted in the specified disk drive.

Under MSX-DOS 2 and Nextor, it is also possible to rename all the files with a specific name inside a folder, for example by adding an extension.

/S is used to rename also the system files. This parameter is available only since COMMAND2.COM 2.40.

/H is used to rename also the hidden files. This parameter is only available under MSX-DOS2 / Nextor.

/P is used to allow a pause at the end of the screen when displaying error messages for files that can't be renamed, because they are marked as 'read only' or for another reason. This parameter is only available under MSX-DOS 2 / Nextor.

MSX-DOS 2 / Nextor allows to rename simultaneously several specified (series of) files with the + part of the mentioned syntaxes. In this case, the /H and /P parameters will apply to all these files when they precede all the other parameters.

Examples

Under MSX-DOS 1 and higher

A>RENAME TEST.TXT TEST1.TXT
A>RENAME B:STORY.TXT STORY1.TXT
A>REN B:*.TXT *.TST

Under MSX-DOS 2 / Nextor

A>RENAME /H /P *.COM *.TXT
A>REN B:\DIR1\*.DOC/H/P *.OLD
A>REN DOC + FILE1 *.OLD

Related to

CONCAT, COPY, DEL, ERASE, FORMAT, MOVE

Compatibility

MSX-DOS 1 with COMMAND.COM, MSX-DOS 2 / Nextor with COMMAND2.COM v2.20 and higher