Linux: Batch rename to remove # leading characters from files of a certain type
by Logan Rogers-Follis on Apr.12, 2015, under Techie
If you have a bunch of files like:
$ ls /home/me/Desktop/Music/
0001 – File1.mp3
0002 – File2.mp3
0003 – File3.doc
…
$
And you want to remove the “0001 – ” from the start of all of them then you can use the following expressing to do this provided they are all in the same folder (if not just run this more than once):
cd /home/me/Desktop/Music/ && for file in *mp3; do mv "$file" "${file:8}"; done
Afterwards:
$ ls /home/me/Desktop/Music/
File1.mp3
File2.mp3
0003 – File3.doc
…
$
NOTE: For more details see http://community.linuxmint.com/tutorial/view/1162 as I got my example from there.