Try New Technology

Linux: Batch rename to remove # leading characters from files of a certain type

by 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.


Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...