rename
Rename a file or group of files with a
regex. WARNING: This command will overwrite files without prompting unless the-noption is used. Note: This page refers to the Perl version, also known asfile-rename. More information: https://manned.org/prename.
- Replace
fromwithtoin the filenames of the specified files:
rename 's///'
- Simulate running the program without doing anything:
rename -n 's///'
- Change the extension:
rename 's/\.$/\./'
- Change to lowercase (use
-fin case-insensitive filesystems):
rename 'y/A-Z/a-z/'
- Capitalize first letter of every word in the name:
rename 's/\b(\w)/\U$1/g'
- Replace spaces with underscores:
rename 's/\s+/_/g'
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
