Linux "rename" Command Line Options and Examples
change the name or location of a file

rename will rename the specified files by replacing the first occurrence of expression in their name by replacement..


Usage:

rename [options] expression replacement file...




Command Line Options:

-s
Do not rename a symlink but its target.
rename -s ...
-v
Show which files where renamed, if any.
rename -v ...
-n
Do not make any changes.
rename -n ...
-o
Do not overwrite existing files.
rename -o ...
-V
Display version information and exit.
rename -V ...
-h
Display help text and exit.EXAMPLESGiven the files foo1, ..., foo9, foo10, ..., foo278, the commandsrename foo foo00 foo?rename foo foo0 foo??will turn them into foo001, ..., foo009, foo010, ..., foo278. Andrename .htm .html *.htmwill fix the extension of your html files. Provide an empty string for shortening:rename '_with_long_name' '' file_with_long_name.*will remove the substring in the filenames.WARNINGThe renaming has no safeguards except the --no-act option. If the user has permission to rewrite file names,the command will perform the action without any questions. For example, the result can be quite drastic whenthe command is run as root in the /lib directory. Always make a backup before running the command, unless youtruly know what you are doing.EXIT STATUS0 all requested rename operations were successful1 all rename operations failed2 some rename operations failed4 nothing was renamed64 unanticipated error occurred
rename -h ...