Linux mren command
The Linux mren command is used to change the name of an MS-DOS file or directory, or to move files or directories.
mren is an MS-DOS utility command, similar to the ren command under DOS, used to change the name of an MS-DOS file or directory.
The source file must be a file that already exists on the disk; if the drive letter and path are omitted, it refers to a file on the current drive and in the current directory.
The new file name is the name you want to change to. You cannot prefix the new file name with a drive letter or path different from the source file, because this command can only change file names on the same drive.
Syntax
mren [源文件或目录...][目标文件或目录]
Parameter Description:
- [source file or directory...]: the source file name or source file path for the operation
Example
To use the mren command to rename the file "autorun.bat" on drive a to "auto.bat", enter the following command:
$ mren a:\autorun.bat auto.bat
#Rename the file autorun.bat to auto.bat
Use the mdir command before and after using this command to view and compare, with the following result:
$ mdir -/ a:\* #查看a盘中的文件
Volume in drive A has no label #加载信息
Volume Serial Number is 13D2~055C
Directory for A:\ #以下为目录信息
./TEST 2011-08-23 16:59 #文件名,目录大小,修改时间
AUTORUN.BAT 43 2011-08-23 16:56
3 files 308 bytes #统计总大小
724 325 bytes free #剩余空间
#Rename the file autorun.bat to auto.bat
$ mren a:\autorun.bat auto.bat
$ mdir -/ a:\* #再次查看a盘中文件
Volume in drive A has no label #加载信息
Volume Serial Number is 13D2~055C
Directory for A:\ #以下为目录信息
./TEST 2011-08-23 16:59 #文件名目录大小 修改时间
#The filename was changed to auto.bat, and the modification time was changed to the current system time
AUTO.BAT 43 2011-08-23 16:56
3 files 308 bytes #统计总大小
724 325 bytes free #剩余空间
Linux Command Reference