Nov 18, 2002 #1 kevmullet Technical User Joined Feb 12, 2002 Messages 56 Location GB OK so i have a bunch of files named like this: "songname - artist.mp3" and i would like them named like this: "artist - songname.mp3" Thanks for any help -K
OK so i have a bunch of files named like this: "songname - artist.mp3" and i would like them named like this: "artist - songname.mp3" Thanks for any help -K
Nov 18, 2002 #2 bigoldbulldog Programmer Joined Feb 26, 2002 Messages 286 Location US This should help. If you have more than one ' - ' then you'll have to figure where the substrings go. for file in *.mp3 do mv -- "$file" `echo $file | sed 's/^\([^ ]*\) - \(.*\).mp3/\2 - \1.c/'` done Cheers, ND bigoldbulldog@hotmail.com Upvote 0 Downvote
This should help. If you have more than one ' - ' then you'll have to figure where the substrings go. for file in *.mp3 do mv -- "$file" `echo $file | sed 's/^\([^ ]*\) - \(.*\).mp3/\2 - \1.c/'` done Cheers, ND bigoldbulldog@hotmail.com
Nov 19, 2002 #3 bigoldbulldog Programmer Joined Feb 26, 2002 Messages 286 Location US That's ... sed 's/^\([^ ]*\) - \(.*\).mp3/\2 - \1.mp3/'` ... Cheers, ND bigoldbulldog@hotmail.com Upvote 0 Downvote