rename or ren:
- Renames a file. Unlike the move command, this command cannot be used to rename subdirectories, or rename files across drives.
ren filename newname
- You can rename files in another directory by using the PATH parameter:
ren [[path\]filename] [newfilename]
- This example renames c:\windows\filex.txt to c:\windows\filey.txt
ren c:\Windows\filex.txt filey.txt
- Using a path in the destination newname will move the file to the new path, if this is on the same device. This renames the file to the c:\temp directory.
ren c:\windows\filex.txt \temp\filey.txt
- On DOS with long filename support, care must be taken when directories have spaces in their names like "Documents and Settings". In these cases double-quotes are used to enclose them. Note it is necessary only to enclose blocks including spaces.
ren c:\"Documents and Settings"\"All Users"\Desktop\filex.txt filey.txt
ren "c:\Documents and Settings\All Users\Desktop\filex.txt" filey.txt
- Wildcards in the destination are replaced by the corresponding part of the original name, so the command below will change the extension of the file from .doc to .txt, here myfile.doc becomes myfile.txt.
ren myfile.doc *.txt
- Mass renames can be accomplished by the use of wildcards. For example, the following command will change the extension of all files in the current directory which currently have the extension htm to html:
ren *.htm *.html
- In Unix, this functionality of a simple move is provided by the mv command, while batch renames can be done using the rename command.
No comments:
Post a Comment