Batching help
I've got some avi files in a directory I want to downsize a lil bit (they may remain avis)
I go into the directory (cd ............) then I want to use this: for FILE in `ls *avi` ; do mencoder -of avi -ovc lavc -lavcoptodec=mpeg4:vbitrate=400:keyint=250:mbd=2:vm ax_b_frames=2:umv:preme=2:vpass=1 -oac mp3lame -lameopts abr:br=64 -vf pp=hb/vb/dr/al/tn,scale=352:288,denoise3d=9:9:9 -ssf lgb=0.7 -ssf cgb=0.7 -ssf ls=0.9 -ssf cs=0.9 $FILE -o New-$FILE && mencoder -of avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400:keyint=250:mbd=2:vmax_b_ frames=2:umv:preme=2:vpass=2 -oac mp3lame -lameopts abr:br=64 -vf pp=hb/vb/dr/al/tn,scale=352:288,denoise3d=9:9:9 -ssf lgb=0.7 -ssf cgb=0.7 -ssf ls=0.9 -ssf cs=0.9 $FILE -o New-$FILE; done ---> this gives me: File not found: 'Family' .. File not found: 'Guy' ... The files are named like this one: Family Guy - Episode 307 - Lethal Weapons.avi How can I tell him to convert all of them (without having to rename every singel one :? ) |
The for command use whitespace as the field separator. I can never remember what I have done in the past to get around this. I should really keep these scripts handy.
You could try using the find command: ie Code:
find <path> -name "*.avi" -exec <cmd string> or you could write a script like Code:
#!/bin/sh |
I like this script (At least I understand what it does...
My problem is that, as a total Linux newbie, I don't really know how to execute this... just inserting it in a convertem.sh and doing a ./convertem.sh gives me a "bash: ./Comem.sh: /bin/sh: bad interpreter: Keine Berechtigung" plz help... I began to like Linux :-D |
It seems that you use bash and not sh. They are two different script interprete.
Type the command "which bash" and note what it gives (let say "/usr/local/bin/bash"). Then just replace the first line "#!/bin/sh" by "!#/usr/local/bin/bash" Warning : There can be only one line starting with "!" and it must be the first one of the script ! This line is a pragma to tell to the system wich interpreter to use to handle the script. |
Hmmmm... funny...
which bash gives me "/bin/bash" but neither Code:
!#/bin/bash Code:
!#!/bin/bash Code:
#!/bin/bash always this: "bash: ./Convertem.sh: Keine Berechtigung" (means sth like... you arent allowed to... you don't have the rights to...) |
I see. Newbie you said ? :-) (no offense)
You have to tell bash that your file is a "executable" script and not a simple text file. Code:
chmod +x ./Convertem.sh |
Hmmmm... I thought he already knew, according to this nice Icon with the shell... (nice pun btw.)
My problem was: Can't change this because I've got these files on a fat32 drive... --> moved the Convertem.sh to my Desktop Folder --> thought it was nice of me to tell him where to go before start working (2nd line) Code:
#!/bin/bash ./Convertem.sh: line 6: syntax error near unexpected token `done' ./Convertem.sh: line 6: `done < ./file.list' As he creates the file.list in the directory with all the avi files, I think this line was ok |
You should use the wonderful man command.
I'm not at the office now, so don't have my workstation running under UNIX but the syntax should be : While <condition> do <commands> done It seems that here you miss the "do". |
h3h3...
too much copy&paste Code:
#!/bin/bash Every time he gives me a "File not found: 'Family'" Hmmmm.... at least he doesn't do File not found: 'Family' File not found: 'Guy' no more Only File not found: 'Family' now |
It seems that you are learning script language, don't you ?
If I were you, learning for learning, I will learn PERL language. I'm a UNIX system engineer, I do scripts since 7 years for my job and the worst pain in the ass for me is when a job must be done for technical reason in shell script ! I do whatever I want in perl in 5 minutes and I need 2 hours to have the same in shell script. I even have windows version of perl installed on my home PC and I use it to do batch encoding of my KVCD ! |
And there is the difference...
I am an 18 year old pupil that can only do some Delphi and VB... *g* I'll have to learn the other stuff in university in 2 years I guess :-D BTW: This seems to work (I used -->"<-- signs) : Quote:
|
From memory, I thought /bin/sh was a soft link to bash in linux?
Another method for executing scripts if they do not have the executable bit set is to do something like /bin/sh ./my_script This has the safety of you will not accidentally execute the script by type ./my_script. @Razorbalde2000: Did you get this working. I should have been more "complete" in the script for you. Any problems, let me know, Cheers, |
Works like a charm :-D
Encoding one file after the next... I just love it... |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.