Convert .flac and .ape to mp3

Victor Sudakov vas at mpeks.tomsk.su
Sat Jan 6 15:18:02 UTC 2018


Michael Ross wrote:
> 
> 
> > So eventually I will need to write a script to process all the *.ape
> > files, probably with bchunk. Which brings the following question. If
> > the file and directory names have spaces in them, a simple loop like
> > this:
> >
> > #!/bin/sh
> > for i in `find . -iname '*.ape'`
> > do
> >   do_something $i
> > done
> >
> > breaks on spaces.
> >
> > What is the sh magic to handle such filenames?
> >
> 
> xargs, you may want to run a few conversions in parallel:
> 
> find . -iname '*.ape' -print0 | xargs -0 -I% -P<parallel_runs> convert %  %.mp3

I'm sure there are many ways to solve the problem, including writing a
C program, but a solution in pure sh has its own value and appeal.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
AS43859


More information about the freebsd-questions mailing list