rename
alllinux
Rename a file or group of files with a `regex`. WARNING: This command will overwrite files without prompting unless the dry-run option is used. Note: This page refers to the Perl version, also known as `file-rename`.
More info →Options (1)
-f, --forcebooleanChange to lowercase (use `-f` in case-insensitive filesystems)
Example:
rename {{[-f|--force]}} 'y/A-Z/a-z/' {{*.txt}}Examples (6)
Replace `from` with `to` in the filenames of the specified files
rename 's/from/to/' *.txtDry-run - display which changes would occur without performing them
rename -n 's/from/to/' *.txtChange the extension
rename 's/\.old$/\.new/' *.txtChange to lowercase (use `-f` in case-insensitive filesystems)
rename [-f|--force] 'y/A-Z/a-z/' *.txtCapitalize first letter of every word in the name
rename [-f|--force] 's/\b(\w)/\U$1/g' *.txtReplace spaces with underscores
rename 's/\s+/_/g' *.txtmade by @shridhargupta | data from tldr-pages