Ubuntu :: Bash Script To Recurse Directories And Exec Ffmpeg Using Find (possibly)?

Oct 3, 2010

I wrote a script that easily runs it in the same directory as it was run below: #for f in *.MTS do ffmpeg -i "$f" -acodec copy -vcodec libx264 -threads 2 -deinterlace -vpre slow -b 20000k -bt 3000k -refs 4 "${f%.MTS}.mp4" ; #done

I want to be able to use the find command so it will recurse through all the videos in my videos folder. Is there a painless way to do this. Here is the start of my find command but it doesn't work. Any help appreciated:

find . -name "*.MTS" -exec ffmpeg -i 'basename{}' -acodec copy -vcodec libx264 -threads 2 -deinterlace -vpre slow -b 20000k -bt 3000k -refs 4 'basename{%.MTS}.mp4'

View 8 Replies


ADVERTISEMENT

Programming :: `find . -exec' Handling Backticks In Bash

May 15, 2011

i had a problem with the find command in bash (which i deem is close enough to a promming language, if not please move this thread :P). i tried to reduce the command to the problem. i want the backticks, or $() for that matter; to be evaluated by -exec of find, not by bash. is that a caveat of find?

Code:

$ find testd -exec echo `basename {}` ; #confused me
test
test/a
test/b

[code]...

edit: i found out whats causing this. `basename {}` gets evaluated by bash before find is invoked, returns {} and `find . -exec echo {} ;" is run. now my question is, how to escape this eveluation from happening before.

View 11 Replies View Related

General :: Postfix Wont Start / Possibly After Deleting Vmail Directories

Sep 25, 2010

How or where can I find more specific information about why it's failing?

View 3 Replies View Related

Fedora :: Could Not Exec /bin/bash Permission Denied?

Sep 24, 2010

trouble when I log in the fedora as a normal user(not root) today. When I fill the username and the password press enter key. Then pop up a little window locate at topleft corner. And have one line message : "/usr/bin/xterm : Could not exec /bin/bash : Permission Denied"hen I log in as root, it's ok. And when I open shell and type "su username" then the console print "su: /bin/bash: Permission denied"I have checked the perms of "/bin/bash" , it's 755. And I have tried all things which suggested from articles searched through Google. like change / or /root and other directory's permissions but failed

View 4 Replies View Related

Programming :: Bash Redirection With Exec: Specify Fd With Variable?

Feb 21, 2010

Within a bash script, I'm attempting to redirect file descriptors with exec, e.g. exec 3>&1 1>&2; however, I'd like to do something like exec $FD>&1 1>&2, which doesn't work because bash tries to execute the value of $FD. Various placements of eval fail, as well. Is there a way around this, or am I stuck hard-coding the descriptor?

View 3 Replies View Related

General :: /usr/bin/xterm: Could Not Exec /bin/bash: Permission Denied

Sep 24, 2010

I'm in trouble when I log in the fedora as a normal user(not root) today. When I fill the username and the password press enter key. Then pop up a little window locate at top left corner. And have one line message : "/usr/bin/xterm : Could not exec /bin/bash : Permission Denied" Then I log in as root, it's ok. And when I open shell and type "su username" then the console print "su: /bin/bash: Permission denied" I have checked the perms of "/bin/bash" , it's 755. And I have tried all things which suggested from articles searched through Google. like change / or /root and other directory's permissions but failed.

Code:

[root@localhost lib]# ldd /bin/bash
linux-gate.so.1 => (0x00687000)
libtinfo.so.5 => /lib/libtinfo.so.5 (0x05846000)

[code]....

View 2 Replies View Related

Ubuntu :: Using Find And Exec - Convert To Ogg?

Mar 12, 2011

I have a bunch of .caf files in a directory that I want to convert to ogg but I cannot figure out way to do it (except manually). I want to do: sox filename.caf filename.ogg

[Code]...

View 2 Replies View Related

Ubuntu Servers :: Resin Can't Find JAVA_HOME - Exec: 40: -jar: Not Found

Aug 21, 2010

I've been following the instructions to install Resin, and all seems to go well until I try to run the /bin/httpd.sh file. It simple says:

Code:

exec: 40: -jar: not found

I suspected this was something to do with my JAVA_HOME variable not being set, so I looked up how to do this and added it to my /etc/bash.bashrc file. Saying "echo $JAVA_HOME" does indeed return the correct path so I don't think this is the problem.

View 5 Replies View Related

General :: Use '{}' To Redirect Output Of A Command Run Through Find's -exec Option?

Jan 10, 2011

I am trying to automate an svnadmin dump command for a backup script, and I want to do something like this:

find /var/svn/* ( ! -name dir -prune ) -type d -exec svnadmin dump {} > {}.svn ;

This seems to work, in that it looks through each svn repository in /var/svn, and runs svnadmin dump on it.

However, the second {} in the exec command doesn't get substituted for the name of the directory being processed. It basically just results a single file named {}.svn.

I suspect that this is because the shell interprets > to end the find command, and it tries redirecting stdout from that command to the file named {}.svn.

View 2 Replies View Related

Programming :: Keep The Bash-script Running If "exec Command" Fails

Aug 13, 2010

Is there a way to use exec, but if exec fails to go on with the script?

Example:

Code:
#!/usr/bin/env bash
exec startx
echo "Starting of X failed"

If startx fails, the echo will be seen on the screen. I tried all kind of stuff, but guess it ain't of much use to post it here. I searched the web, but searching for "exec and bash" in one sentence does give results which are not what i am looking for.

View 6 Replies View Related

Programming :: Ffmpeg Stopping After The First Encode When Using Bash Script?

Apr 6, 2010

I'm trying to create a script that will trawl through a directory structure looking for VOB files, convert them to AVI and place them in a ./converted/ sub-directory of the the original source folder. I've knocked up the script below which appears to work fine when I place an "echo" in front of the actual ffmpeg encode line, I get the output on the screen with ffmpeg finding all the VOB files in the directories and looking to convert them to the correct sub-directory. Yet, when I remove the echo and run the script for real, ffmpeg converts the first file and then stops. No errors. Is this something to do with ffmpeg or a problem with my script below?

Code:
#!/bin/bash
#

[code]...

View 6 Replies View Related

General :: Find A File In Directories Without Using Find Command?

Aug 3, 2010

am new to linux and trying to find a file in sub directories using find command as:find .-name *.jpg -type fBut I am unable to get the result as find command is not permitted by the server administrator.Is there any way to find files without using find command.

View 14 Replies View Related

General :: Ran "find / -mtime +1 -exec Rm {} ;" - Trying To Clear A Directory ?

Jul 6, 2011

I'm very very tired, worked all night long, and I did't sleep for hours... So I'm like a zombie now... half awake, and half asleep.

I was trying to clear a directory. Then I run the command cd to enter the directory, and then before thinking I run this dangerous command. on my Linux server: "find / -mtime +1 -exec rm {} ;"

I got a lot of:

Could this command have deleted something inside these directories? I'm afraid that the next reboot the server won't startup...

View 2 Replies View Related

Ubuntu :: Recurse A Subdir Tree To Apply Chmod And Chown And Ls -al?

May 30, 2011

Need to recurse a subdir tree, to apply chmod and chown and ls -al .

chmod -R xxx yyy does not function properly; -R is nonfunctional.
chown -R xxx yyy functions OK.

Is there a script which will follow a subdir tree and open each subdir ? glene77is

View 9 Replies View Related

General :: How To Navigate Certain Directories With Bash

Jun 28, 2011

I'm very new to working with the terminal on my macbook pro and am trying to understand how to navigate into certain directories with it. I can't seem to get out of my username directory. I'm trying to access MAMP/htdocs and get those files into my git repository. I'm new to all of this. I am typing and getting this:
David-Adamss-MacBook-Pro:~ davidadams$ cd Applications/MAMP/htdocs/barcodes
-bash: cd: Applications/MAMP/htdocs/barcodes: No such file or directory
I need to get the "davidadams$" out of that line but I don't know how to navigate out of it.

View 6 Replies View Related

Ubuntu :: Bash-completion + Mount = Failure To Complete Directories?

May 27, 2011

I've spent some time searching for answers to this and I haven't found much at all.Please feel free to post pointers to other threads that discuss this particular problem, if you find any.The problem is that in bash I want to mount an iso file to inspect the contents with the command:Code:sudo mount myCD.iso CDMount -o loopThe command works fine, but pressing tab to complete either the iso filename or the CDMount directory does not work. The completion suggestions I get are existing mountpoints which The completion suggestions should include the files and directories in the current directory. This worked with Ubuntu 10.04 and not with 11.04.

View 1 Replies View Related

Fedora :: Command Line To Recurse And Delete Filename-1.jpg?

Oct 26, 2010

I just installed Picasa from google and it has corrupted my picture database. The good thing is that it has done it in an organized manner. It appended -1 -2 -3 and so on to the copies file name. They look like (filename.jpg filename-1.jpg filename-2.jpg) the original having no numerical suffix just (filename.jpg)How do i write a command line to remove all of the undesirables without deleting the origionals?

View 7 Replies View Related

Programming :: Synchronize Two Directories (bash Script)?

Feb 11, 2011

It achieves a bash script that takes two parameters (command line). These two parameters must be two paths of two directories (existing, and different such as not being of the other sub-folder). Path1 and path2 are for simplicity.The script will recursively visit the two directories and all sub-directories, sub-sub-directories, etc.. Looking for differences between their contents (files or directories). In particular, suppose that we work with both path1 and path2 directory, and scanned the files contained therein. These situations can occur:

* Path1 exists in a file that is not present in path2: in this case, the script displays the path of the file to you (print screen) and asks if he wants the file is copied in path2 or not. Reads the user's response and acts accordingly.

* Path2 exists in a file that is not present in path1: in this case, the script displays the path of the file and asks if the user wants the file is copied in path1 or not. Reads the user's response and acts accordingly.

* Both path1 path2 in a file with the same name but different contents: in this case, the script displays the path of the two files (which of course will start with path1 and path2 but end with an equal) to the user together with the two dates have been changed last time. Then asks if you want the file to be replaced by one in path1 path2, or that the file is replaced by one in path2 path1, or that both are left unchanged. Reads the user's response and acts accordingly.

* Both path1 path2 in a file with the same name and same content, in which case the script does nothing and proceeds with the next file.This is done for all regular files in path1 and path2. The special file (socket, device, symbolic link ...) are ignored. For folders in path1 and path2 is recursively by:

* Path1 if there is a folder that is not present in path2: in this case, the script displays the path to the folder and asks if you want the folder and all its contents are copied to path2. Reads the user's response and acts accordingly.

* Path1 if there is a folder that is not present in path2: similar at first.

* Both path1 path2 that there are two folders with the same name as the script works recursively on the two folders.

View 2 Replies View Related

Programming :: Bash Script For Cleaning Home Directories

Jul 25, 2011

Im running on Solaris 10 and I am trying to write a script that will look at all the directories in export.home and then grep for the those in passwd and will display the directories that don't have a password associated with them

Here is what I got so far but its not working.
#!usr/bin/bash
for i in 'ls /export/home'
do
test='getent passwd | grep $i'
if [ $test="" ]
then
echo "No Home Diectories Found $i"
fi
done

All this does is display what was listed in the export.home. What I want it to do is just display what was not found in password.

View 2 Replies View Related

General :: Bash - Mirroring Of Multiple Directories - Hard Linking

Apr 11, 2011

I have 5 FTP users that upload files (and subdirectories) in their home directory, i need to mirror theese directories beetween them and with a "master" directory (accessible from a 6th user). Files can contain spaces or others special caracters. All the files are in the same filesystem, and i want to use hard link because i don't want to waste 5 time the space of a single file. I tried with find but i cannot handle spaces in it.

View 1 Replies View Related

General :: Delete All Files (except The Four Newest) Throughout Directories Using A Bash Script?

Aug 16, 2011

I'm looking for a Bash script that will go into a list of directories and delete all but the four most recently created files.

How can I do this?

View 4 Replies View Related

Ubuntu Multimedia :: Ffmpeg 6 Is Out For Some Time When Will Lucid Afford Such A New Ffmpeg?

Jul 20, 2010

Since ffmpeg 6 is out for some time, when will Ubuntu Lucid afford such a new ffmpeg package from its repository?

View 2 Replies View Related

Ubuntu :: Where To Find Ssh-mounted Directories

Dec 26, 2010

I go to places-acces server-ssh and connect to a remote server with Nautilus.All ok.But I prefer to use vifm as my main file manager: I try to find the ssh-mounted devices in /mnt or /media but cannot fin them.Does anybody know where they are?

View 2 Replies View Related

Ubuntu :: Nautilus Action To Find Files In Directories

Aug 27, 2010

When I am in Nautilus, I want to be able to select a directory, then right click (or some other action) to do a file find on that directory. The gnome-search-tool would be a good candidate for this, if it could be an action in Nautilus. I know I can do a file find through other means, but Nautilus seems to be where I am when I want to search directories.

View 6 Replies View Related

Ubuntu :: Find Files With Directories And Sort By Mod Time?

Dec 4, 2010

what i wanted to do was find all the files with a specific name from a tree, sort them by modification time and have their directory appended to them so that i knew where they were (because they all have the same name). i tried a whole bunch of different things and finally did this:

Code:
find . -type f -name world.sav -exec ls -l '{}' ; > ~/dfsaves.txt; gawk '{$1=""; $2=""; $3=""; $4=""; $5=""; print}' ~/dfsaves.txt | sort -n > ~/dfsavessorted.txt

this did the trick pretty well, but as you can see it is far from elegant and i think i'm doing some things wrong and kludgy

first thing i tried was "ls -lRt | grep world.sav" which worked except i couldnt distinguish the files because there were no directories. that took a lot of looking till i accepted i couldnt make ls print directories as well and append them to the files somehow that their relationship would be clear. i tried piping ls to find, doing it in reverse, passing them from grep etc. etc. until i read some more stuff online that got me using gawk and sort. the questions:

1. is there some other, more elegant and simple way to do this kind of detection and sorting?

2. is there any way to use a pipe after using exec? the semicolon seems to prevent this entirely, forcing me to use an intermediate file as above. i could just remove it later, but i'd prefer a straight piping.

View 8 Replies View Related

General :: Excluding Directories With Find?

Jun 10, 2011

I am trying to exclude 2 directories with find and pass it into cpio. I have tried

Code:
find . -depth -path '.evolution' -prune -o -path '.gconf' -prune -o -print|cpio -aov > /media/caca/full$date
./.gconf/apps/evolution/memos/%gconf.xml
./.gconf/apps/evolution/memos

[Code]....

View 4 Replies View Related

Programming :: How To Find Directories That Do Not Have A Certain File

May 28, 2010

I'm having problems figuring out the process to find directories that DO NOT contain a certain file. I have a mp3 collection that all the album art is name "folder.jpg". Not all the albums have images. I need a way to find the albums/directories that do not contain "folder.jpg". I can find the ones that do contain "folder.jpg" with

Code:
find . -iname 'folder.jpg' -print0 | xargs -0 ls >> album_art

but that is as far as my bash-fu can take me. I'm not really sure what my next step is.

My directory structure is like such: a-z/artist/album/folder.jpg

View 5 Replies View Related

Ubuntu :: Creation Date For Directories Isn't Stored Or At Least Couldn't Find It?

Feb 19, 2010

i'm trying to make a script that gives one output if a directory in /home is older than one month, and another if the directory is less than one month old. I looked around and saw that the creation date for directories isn't stored, or at least i couldn't find it? How is this possible to do then?

View 2 Replies View Related

General :: How To Exclude Multiple Directories In Awk With Find?

May 20, 2010

I found a script on webmaster world that mostly does what I need it to, but have been making modifications to tailor it to my specific needs.I know that //..*/ tells awk to ignore hidden directories, how do I define more directories to ignore? (i.e. temp, var, etc)? I've tried playing with prune before the awk command with limited success...I know that there are many ways to do the same thing and keep running into brick walls.

View 11 Replies View Related

General :: Scripting To Find Difference Between 2 Directories

Dec 17, 2010

Write a script to list all the differences between two directories.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved