English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux mren command

Linux Command大全

The Linux mren command is used to change MS-DOS file or directory name, or move file or directory.

mren is MS-DOS utility command, similar to the ren command under DOS, which can change MS-DOS file or directory name.

The source file must be a file that already exists on the disk. If the disk drive and path are ignored, it means the file in the current disk and current directory.

The new file name is the name of the file to be replaced. The new file name cannot be prefixed with a disk drive or path different from the source file, because this command can only change the file name on the same disk.

Syntax

mren [source file or directory...][target file or directory]

Parameter description:

  • [Source file or directory…]: Source file name or source file path for executing the operation

  • [Target file or directory]: Target file name or target file path for executing the operation

Online Examples

Use the mren command to change the filename of the file "autorun.bat" under 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 the operation to view and compare the results as follows:

$ mdir -/ a:\*                  #View files in drive A  
Volume in drive A has no label  #loading information  
Volume Serial Number is 13D2~055C  
Directory for A:\                   #directory information  
./TEST <DIR> 2018-08-23 16:59       #Filename, directory size, modified time  
AUTORUN.BAT 43 2018-08-23 16:56  
3 files 308 bytes                   #total size  
724 325 bytes free              #remaining space  
#Rename the file autorun.bat to auto.bat  
$ mren a:\autorun.bat auto.bat        
$ mdir -/ a:\*                  #View files in drive A again  
Volume in drive A has no label      #loading information  
Volume Serial Number is 13D2~055C  
Directory for A:\                   #directory information  
./TEST <DIR> 2018-08-23 16:59       #Filename directory size modified time  
#Filename changed to auto.bat, modified time changed to current system time  
AUTO.BAT 43 2018-08-23 16:56          
3 files 308 bytes                   #total size  
724 325 bytes free              #remaining space

Linux Command大全