Latest web development tutorials

Linux mren command

Linux mren command

Linux command Daquan Linux command Daquan

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

mren tool for MS-DOS commands and DOS commands ren under similar, you can change the MS-DOS file or directory name.

The source file must be a file that already exists on the disk, drive letter and path if ignored, then the current disk and directory of the current file.

The new file name is the name of the file to be replaced. You can not add the source file path to a different drive letter and before the new file name, because the command can only change the file names for the same disk.

grammar

mren [源文件或目录...][目标文件或目录]

Parameter Description:

  • [Source file or directory ...]: source file name to perform operations or source file path
  • [Target file or directory]: Target file name or path of the target file to perform the operation

Examples

Use the file command mren a drive under the "autorun.bat" file name changed to "auto.bat", enter the following command:

$ mren a:\autorun.bat auto.bat  
#将文件autorun.bat重命名为auto.bat  

Before and after using this command mdir command to view and compare the results obtained are as follows:

$ mdir -/ a:\*                  #查看a盘中的文件  
Volume in drive A has no label  #加载信息  
Volume Serial Number is 13D2~055C  
Directory for A:\                   #以下为目录信息  
./TEST <DIR> 2011-08-23 16:59       #文件名,目录大小,修改时间  
AUTORUN.BAT 43 2011-08-23 16:56  
3 files 308 bytes                   #统计总大小  
724 325 bytes free              #剩余空间  
#将文件autorun.bat重命名为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 <DIR> 2011-08-23 16:59       #文件名目录大小 修改时间  
#文件名被改为auto.bat,修改时间改为当前系统时间  
AUTO.BAT 43 2011-08-23 16:56          
3 files 308 bytes                   #统计总大小  
724 325 bytes free              #剩余空间  

Linux command Daquan Linux command Daquan