Shell Scripting Question

Place to discuss Fedora and/or Red Hat

Shell Scripting Question

Postby Doogee » Mon Nov 17, 2003 12:39 am

Ok i have a whole bunch of mp3s in a folder with the extention *.mp3.OK currently i have to rename them as *.mp3 to play them in xmms.

My question is is there any way to rename the files with the proper *.mp3 extentions while still keeping the proper file name of the song?
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Postby Void Main » Mon Nov 17, 2003 9:16 am

This should do it, right on the bash command line:

Code: Select all
for file in *OK; do mv "$file" "${file%%.OK}"; done
User avatar
Void Main
Site Admin
Site Admin
 
Posts: 5705
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA

Postby Doogee » Mon Nov 17, 2003 11:14 pm

my friend you are a genius
i will alias that now
Doogee
administrator
administrator
 
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am


Return to Fedora/Red Hat

Who is online

Users browsing this forum: Google [Bot] and 0 guests

cron