[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: changing extensions, a little OT perhaps.



On Fri, 26 Apr 2002 13:32:33 -0400
Bob Torres <bob@rjtorres.net> blurted in message
[🔎] 20020426173233.GB5659@rjtorres.net:

> Hi All,
> 
> I recently transferred some MP3s from my MacOS desktop to my Debianppc
> laptop.  There are no file extensions for these mp3 files, so they're
> kind worthless for xmms in Linux. 
> 
> On the Linux side, how would I go about adding extensions to these files
> without doing it manually?  In other words, is there something I could
> pass at the command line to accomplish this for a whole directory of
> files?  I've been using Linux for three years or so now, and I've always
> wanted to know how to do this...anyone care to educate me?  I'm hoping
> for something a little more substantive than "go learn sed (or whatever
> program)," though learning by example usually works the best for me. ; )
> 
if it's just adding an extension:

for FILE in * ; do
	if [ -f "${FILE}.mp3" ] ; then
		echo "${FILE}.mp3 already exists!"
	else
		mv "${FILE}" "${FILE}.mp3"
	fi
done

if they already have extensions, you can use rename:
rename MP3 mp3 *.MP3

L.
-- 
 Liam Bedford | Greg: Can't you see you're all alcoholics?
--------------| Guv: Oi. We don't call them that. We call
                     them fanatical followers of the Ale
		     Kaeda network.


-- 
To UNSUBSCRIBE, email to debian-powerpc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: