Automatic way of applying the same command to a bunch of files

Andy Green andy at warmcat.com
Wed Sep 20 13:45:22 UTC 2006


Paul Smith wrote:
> On 9/20/06, Andy Green <andy at warmcat.com> wrote:
>> >> 12\ Missa\ brevis\ in\ G,\ KV\ 140App,\ C1.\ 12\ Agnus\ Dei.wav
>> >
>> > Perhaps the best strategy is to eliminate all '\' and then use "$i".
>> > However, I do not know how to implement it.
>>
>> No Paul Howarth's method was best, the problem is probably coming from
>> the commas.  For example, can you do the sox by hand with that filename
>> even?
> 
> Yes, I can, Andy.

Hm well this works for me with the filename

$ ls *.wav
12 Missa brevis in G, KV 140App, C1. 12 Agnus Dei.wav

for i in *\ * ; do sox "$i" -r 44100 -t wav "output_$i" ; done

You need the -t otherwise sox gets confused trying to work it out from 
the suffix; because it contains dots in the file part it complains that 
the type " 12 Agnus Dei.wav" is unknown without -t.

-Andy




More information about the fedora-list mailing list