Wednesday, February 9, 2011

Bulk rename files in Linux

Use the rename command :

To add the album title at the beginning :$ rename -v 's/^/TITLE-HERE-/' *.mp3

-v : verbose
s : substitute. it acts in the same way as regular expressions do in SED.

To replace a part of filename: $ rename -v 's/MISC\.\ -/Fossils-/' *.mp3

e.g. :-
MISC. - 01.mp3 to Fossils-01.mp3
MISC. - 02.mp3 to Fossils-02.mp3
MISC. - 03.mp3 to Fossils-03.mp3


To rename to lower case: $ rename 'y/A-Z/a-z/' *

To rename recursively: $ find ./ -type f -exec rename 'y/A-Z/a-z/' {} \;

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...