Shell Scripting Question

Place to discuss Fedora and/or Red Hat
Post Reply
Doogee
administrator
administrator
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Shell Scripting Question

Post by 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?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by 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

Doogee
administrator
administrator
Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

Post by Doogee » Mon Nov 17, 2003 11:14 pm

my friend you are a genius
i will alias that now

Post Reply