Quantcast

recursive loop through directory in osx

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

recursive loop through directory in osx

Ian McPherson
I want to use the following command on a media directory to convert a load
of MKV to MP4. the command works fine. just need the loop to process
through. how do I do that ?

for f in *.mkv;do ffmpeg -i "$f" -c copy "${f%mkv}mp4";done

file structure is:
/ TV / Program One / S01 / EP01.mkv
/ TV / Program One / S01 / EP02.mkv
/ TV / Program Two / S01 / EP01.mkv
/ TV / Program Two / S01 / EP02.mkv
/ TV / Program Two / S02 / EP01.mkv


the command will convert all files in the same directory but that means
manually going up and down etc
I just want to start in the top directory (/TV/) kick off the loop and
leave it to it !

would be nice to add a delete command post conversion also :)

this is running on a Mac desktop




TIA.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: recursive loop through directory in osx

Liam
On Thu, May 11, 2017 at 1:41 PM, Ian McPherson <[hidden email]> wrote:

> I want to use the following command on a media directory to convert a load
> of MKV to MP4. the command works fine. just need the loop to process
> through. how do I do that ?
>
> for f in *.mkv;do ffmpeg -i "$f" -c copy "${f%mkv}mp4";done
>
> file structure is:
> / TV / Program One / S01 / EP01.mkv
> / TV / Program One / S01 / EP02.mkv
> / TV / Program Two / S01 / EP01.mkv
> / TV / Program Two / S01 / EP02.mkv
> / TV / Program Two / S02 / EP01.mkv
>
>
Some clues here, although the space in your directory names may be a
special problem:

http://stackoverflow.com/questions/6122341/for-loop-for-files-in-multiple-folders-bash-shell

--
<https://www.google.com/a/contentbridge.tv/images/logo.gif>
*William Caulfield *| *ContentBridge Systems*
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Loading...