Body
Imagine writing this:
for i in *; do echo mv $i "`echo $i | cut -d - -f 3 | tr _ " "`.mp3"; done | sed s/\(/\\\\\(/g | sed s/\)/\\\\\)/g
To get this output:
mv 01-backstreet_boys-everybody_\(backstreets_back\)-bul.mp3 "everybody \(backstreets back\).mp3"
mv 02-backstreet_boys-weve_got_goin_on-bul.mp3 "weve got goin on.mp3"
mv 03-backstreet_boys-get_down_\(youre_the_one_for_me\)-bul.mp3 "get down \(youre the one for me\).mp3"
mv 04-backstreet_boys-as_long_as_you_love_me-bul.mp3 "as long as you love me.mp3"
mv 05-backstreet_boys-quit_playin_games_\(with_my_heart\)-bul.mp3 "quit playin games \(with my heart\).mp3"
mv 06-backstreet_boys-ill_never_break_your_heart-bul.mp3 "ill never break your heart.mp3"
mv 07-backstreet_boys-thats_the_way_i_like_it-bul.mp3 "thats the way i like it.mp3"
mv 08-backstreet_boys-hay_mr._dj_\(keep_playin_this_song\)-bul.mp3 "hay mr. dj \(keep playin this song\).mp3"
mv 09-backstreet_boys-if_you_want_to_be_a_good_girl-bul.mp3 "if you want to be a good girl.mp3"
mv 10-backstreet_boys-i_wanna_be_with_you-bul.mp3 "i wanna be with you.mp3"
mv 11-backstreet_boys-anywhere_for_you-bul.mp3 "anywhere for you.mp3"
mv 12-backstreet_boys-all_i_have_to_give-bul.mp3 "all i have to give.mp3"
mv 13-backstreet_boys-10_000_promises-bul.mp3 "10 000 promises.mp3"
mv 14-backstreet_boys-boys_will_be_boys-bul.mp3 "boys will be boys.mp3"
mv 15-backstreet_boys-lets_have_a_party-bul.mp3 "lets have a party.mp3"
mv 16-backstreet_boys-like_a_child-bul.mp3 "like a child.mp3"
mv 17-backstreet_boys-if_i_dont_have_you-bul.mp3 "if i dont have you.mp3"
After verifying that everything is OK, pipe the command output to bash:
for i in *; do echo mv $i "`echo $i | cut -d - -f 3 | tr _ " "`.mp3"; done | sed s/\(/\\\\\(/g | sed s/\)/\\\\\)/g | bash
Cool, You've got a directory renamed!
I usually do this trick, I don't know why am I posting it this time!
Anyway, Any idea why I have to use s/\(/\\\\\(/ ?
- 1603 views
Add new comment