Bulk renaming of files

This command…

for i in * ; do j=`echo $i | sed ‘s#Matt#Cyberfella#g’ – ` ; mv “$i” “$j” ; done

turns a file listing like this…

Matt_001_blah.txt

Matt_002_blah-de-blah.txt

Matt_003_blah.txt

into this…

Cyberfella_001_blah.txt

Cyberfella_002_blah-de-blah.txt

Cyberfella_003_blah.txt

Just change the search and replace strings accordingly to swap a common text string occurring in the filenames to something else (or leave the replace string blank to eradicate it).

image_pdfCreate PDF of this post...
Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.