Bash recursing mp3.2.ogg conversion

Nifty Hat Mitch mitch48 at sbcglobal.net
Tue Nov 15 23:19:39 UTC 2005


On Fri, Sep 02, 2005 at 10:48:55PM +0100, Dave Mitchell wrote:
> Date: Fri, 2 Sep 2005 22:48:55 +0100
> From: Dave Mitchell <davem at iabyn.com>
> To: For users of Fedora Core releases <fedora-list at redhat.com>
> Subject: Re: Bash recursing mp3.2.ogg conversion
> Reply-To: For users of Fedora Core releases <fedora-list at redhat.com>
> 
> On Fri, Sep 02, 2005 at 04:29:34PM -0400, Rodolfo Alcázar wrote:
> > On Fri, 2005-09-02 at 15:23 -0500, Bill Gradwohl wrote:
> > > On Fri, 2005-09-02 at 15:55 -0400, Rodolfo Alcázar wrote:
> > > > for f in $(find . -name "*mp3"); do command-mp3-2-ogg $f; done
> > > Put double quotes around the $f as - "$f" - to force file names that
> > > include spaces to be treated properly.
> > 
> > NOP. See what hapens with an echo, so you can see the output.
> > 
> > $ for f in $(find . -name "*mp3"); do echo command-mp3-2-ogg "$f"; done
> > 
> > command-mp3-2-ogg ./Sting/Englishman
> > command-mp3-2-ogg In
> > command-mp3-2-ogg New
> > command-mp3-2-ogg York.mp3
> > command-mp3-2-ogg ./Sting/The
> > command-mp3-2-ogg Hounds
> > command-mp3-2-ogg Of
> > command-mp3-2-ogg Winter.mp3
> > 
> > Any other suggestion?
> 
> find . -name '*.mp3' | xargs -i= echo command-mp3-2-ogg =

Do recall the gnu -print0 flag for find and -0 flag for xargs.

   find . -name '*.mp3' -print0 | xargs -0 command-mp3-2-ogg

The $( some subshell generates list ) can have a side effect
where the command line max input runs out of space.  This is
solved classicly with find and xargs.  The newer problems of 
ill behaved file names is solved with -print0  and -0


-- 
	T o m  M i t c h e l l 
	Found me a new place to hang my hat :-)
	Found me a cable too.





More information about the fedora-list mailing list