Isn’t it just beautiful – no. 2

Today I bought Slipknot‘s Antennas to hell via amazon mp3. I don’t like all the cloud bullshit, so I downloaded the files to my old fashioned mp3 player and found they have some ridiculous file naming pattern at amazon. But as usual … Linux (actually bash) could fix that easily.

The file names the download came in looked like this.

B008OIQVDK_(disc_1)_01_-_(sic)_[Explicit].mp3
B008OIQVKS_(disc_1)_02_-_Eyeless_[Explicit].mp3
B008OIQVR6_(disc_1)_03_-_Wait_And_Bleed.mp3
B008OIQVZ8_(disc_1)_04_-_Spit_It_Out_[Explicit].mp3
B008OIQW5W_(disc_1)_05_-_Surfacing_[Explicit].mp3
B008OIQWDE_(disc_1)_06_-_People_=_Shit_[Explicit].mp3
B008OIQWKM_(disc_1)_07_-_Disasterpiece_[Explicit].mp3
B008OIQWS4_(disc_1)_08_-_Left_Behind.mp3
B008OIQWXO_(disc_1)_09_-_My_Plague_(New_Abuse_Mix).mp3
B008OIQX5Q_(disc_1)_10_-_The_Heretic_Anthem_(Live)_[Explicit.mp3
B008OIQXAQ_(disc_1)_11_-_Purity_(Live)_[Explicit].mp3
B008OIQXFG_(disc_1)_12_-_Pulse_Of_The_Maggots.mp3
B008OIQXLK_(disc_1)_13_-_Duality.mp3
B008OIQXTM_(disc_1)_14_-_Before_I_Forget.mp3
B008OIQXZ6_(disc_1)_15_-_Vermilion.mp3
B008OIQY4G_(disc_1)_16_-_Sulfur.mp3
B008OIQYAU_(disc_1)_17_-_Psychosocial.mp3
B008OIQYK0_(disc_1)_18_-_Dead_Memories.mp3
B008OIQYV4_(disc_1)_19_-_Snuff.mp3

For me, being the old fashioned guy I am, file names have to clearly indicate artist and song name. I don’t look at meta tag crap and don’t use media library somethings, I use file system structure. Top level folder = artist, second level folder = album, filename includes artist, song number and song title. Like it or not. So … that apparently random prefix and the disc_1 thing had to go. Bash to the rescue:

ls|while read f; do mv $f ${f/#*)_/Slipknot_-_}; done

This is a loop over all files in the directory. For each run, $f is filled with the original filename. $f is then moved to what $f would be with everything up to “)_” replaced by “Slipknot_-_”. Here’s an ls after that little tweak:

Slipknot_-_01_-_(sic)_[Explicit].mp3
Slipknot_-_02_-_Eyeless_[Explicit].mp3
Slipknot_-_03_-_Wait_And_Bleed.mp3
Slipknot_-_04_-_Spit_It_Out_[Explicit].mp3
Slipknot_-_05_-_Surfacing_[Explicit].mp3
Slipknot_-_06_-_People_=_Shit_[Explicit].mp3
Slipknot_-_07_-_Disasterpiece_[Explicit].mp3
Slipknot_-_08_-_Left_Behind.mp3
Slipknot_-_09_-_My_Plague_(New_Abuse_Mix).mp3
Slipknot_-_10_-_The_Heretic_Anthem_(Live)_[Explicit.mp3
Slipknot_-_11_-_Purity_(Live)_[Explicit].mp3
Slipknot_-_12_-_Pulse_Of_The_Maggots.mp3
Slipknot_-_13_-_Duality.mp3
Slipknot_-_14_-_Before_I_Forget.mp3
Slipknot_-_15_-_Vermilion.mp3
Slipknot_-_16_-_Sulfur.mp3
Slipknot_-_17_-_Psychosocial.mp3
Slipknot_-_18_-_Dead_Memories.mp3
Slipknot_-_19_-_Snuff.mp3

As my daugher’d say: “dadaaa”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s