From: x1 Date: 2006-01-18T13:42:28+09:00 Subject: Re: Looping through files using exec You said bash... Does "Done" represent a directory? and.. does Done\#{filename} work with this option? I would have thought that in *nix, it would be Done/#{filename} Not exactly sure what this app is supposed to do but the loop looks ok.. irb(main):004:0> puts "mencoder \"" + x + "\" -vf scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=150 -oac mp3lame -lameopts vbr=3:br=64 -o \"Done\\" + x + "\"" mencoder "pron.avi" -vf scale=320:240 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=150 -oac mp3lame -lameopts vbr=3:br=64 -o "Done\pron.avi" On 1/17/06, Jason Cameron wrote: > I'm trying to do a mass encode of a large directory of media files but > I'm not having much luck. I tried to use bash but it doesn't like > filenames with spaces so now I'm trying to do it with ruby but using the > exec command it executes the first line then finishes. Here's what I've > done in the IRB. > > Dir["*.avi"].each {|x| exec ("mencoder \"" + x + "\" -vf scale=320:240 > -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=150 -oac mp3lame -lameopts > vbr=3:br=64 -o \"Done\\" + x + "\"") } > > It would be sweetness on a stick if it worked but unfortunately it stops > after the first one. Can anyone tell me what I'm doing wrong and more > importantly what I need to do to make this work? > > Thanks in advance, > > I > > -- > Posted via http://www.ruby-forum.com/. > >