Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jan 2018 17:12:37 +0100
From:      Andreas Perstinger <andipersti@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Convert .flac and .ape to mp3
Message-ID:  <06f10c10-8e39-ec9b-de84-0c345c8be229@gmail.com>
In-Reply-To: <20180106151754.GA35747@admin.sibptus.transneft.ru>
References:  <20180104163421.GA15692@admin.sibptus.transneft.ru> <20180104175156.440fa0c2.freebsd@edvax.de> <20180106063934.GA32231@admin.sibptus.transneft.ru> <op.zce38vcag7njmm@workstation> <20180106151754.GA35747@admin.sibptus.transneft.ru>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 2018-01-06 16:17, Victor Sudakov wrote:
> Michael Ross wrote:
>> > #!/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.

Well, you use already the find command, so why don't you use it's full 
power?

https://unix.stackexchange.com/questions/321697
(Why is looping over finds output bad practice?)

Bye, Andreas



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?06f10c10-8e39-ec9b-de84-0c345c8be229>