[ale] Problems w/ mv and sed

Stephen Touset stephen at touset.dyndns.org
Mon Dec 23 22:14:51 EST 2002


What do you mean by "embedded" spaces? I'll just show you a few
examples...

Final Fantasy X - OST - Disc 1 - 02. To Zanarkand.mp3.OK
Final Fantasy X - OST - Disc 1 - 03. The Prelude.mp3.OK
Final Fantasy X - OST - Disc 1 - 04. Tidus' Theme.mp3.OK
Final Fantasy X - OST - Disc 1 - 05. Otherworld.mp3.OK
Final Fantasy X - OST - Disc 1 - 06. Hurry.mp3.OK
Final Fantasy X - OST - Disc 1 - 07. This Is Your Story.mp3.OK


On Mon, 2002-12-23 at 21:23, Geoffrey wrote:
> Do the file names have embedded spaces?
> 
> Stephen Touset wrote:
> > I still get
> > 
> > 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.
> > 
> > Stephen Touset
> > 
> > On Mon, 2002-12-23 at 20:29, Geoffrey wrote:
> > 
> >>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
> > 
> > 
> > 
> 
> -- 
> 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


 This is a digitally signed message part




More information about the Ale mailing list