Index

rename

regex rename all files in current directory
rename 's/[regex]/[replace]/' *
print changes, dont actually rename
rename -n 's/[regex]/[replace]/' *

syntax

identity rename
rename -n 's/(.*)/$1/' *
append .txt extension
rename -n 's/(.*)/$1.txt/' *
examplesremove leading whitespace from file (or dir) names
rename -n 's/^ *//' *
remove trailing whitespace from file (or dir) names
rename -n 's/ *$//' *