[ale] Problems w/ mv and sed

Geoffrey esoteric at 3times25.net
Mon Dec 23 20:29:31 EST 2002


We just covered something similar to this a few days ago.  Try this:

for fn in *.OK;do
	mv $fn ${fn%.OK}
done

Stephen Touset wrote:
> I've been busy getting some music on gtk-gnutella, and it evidently
> renamed files to $(FILENAME).OK if it's good after completion, or
> $(FILENAME).BAD if it's corrupted. This is all fine and dandy, except
> XMMS uses the filename to determine whether or not it can play the file.
> Not to mention, I'd rather not have an .mp3 collection entirely named
> .mp3.OK. So this is a job for sed, right? Well, here's the command I
> wrote up, and here's the output:
> 
> for FILE in ./*\.OK; do mv \"$FILE\" \"`echo $FILE | sed -e
> 's/\.OK//'`\"; done;
> 
> mv: when moving multiple files, last argument must be a directory
> Try `mv --help' for more information.
> mv: when moving multiple files, last argument must be a directory
> Try `mv --help' for more information.
> mv: when moving multiple files, last argument must be a directory
> Try `mv --help' for more information.
> mv: when moving multiple files, last argument must be a directory
> Try `mv --help' for more information.
> mv: when moving multiple files, last argument must be a directory
> Try `mv --help' for more information.
> 
> etc.
> 
> However, when I use an echo command within the statement:
> 
> for FILE in ./*\.OK; do echo mv \"$FILE\" \"`echo $FILE | sed -e
> 's/\.OK//'`\"; done;
> 
> I get:
> 
> mv "./Boston Pops - Final Fantasy 7 Theme.mp3.OK" "./Boston Pops - Final
> Fantasy 7 Theme.mp3"
> mv "./Boston Pops - Gone With The WInd - Tara's Theme.mp3.OK" "./Boston
> Pops - Gone With The WInd - Tara's Theme.mp3"
> 
> etc.
> 
> Which seems to be as it should. Anyone know what might be causing this?
> 
> Stephen Touset

-- 
Until later: Geoffrey		esoteric at 3times25.net

The latest, most widespread virus?  Microsoft end user agreement.
Think about it...

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list