-1

This question already has an answer here:

How can I recursively find all audio and video files in a directory and move them elsewhere in a single operation?

marked as duplicate by Archemar, jimmij, Jeff Schaller, PersianGulf, Wouter Verhelst Jun 27 '16 at 15:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Do you have a set of file extensions that you're trying to process? If they're enumerable please do so (in your question) – roaima Jun 26 '16 at 20:59
  • roaima - Multimedia files, like avi,m4v,mov,mp4,mpeg,mpg,wmv,flv,webm,ogv,mkv,mp3, etc. About 2 dozen possible extensions. – Terry Romphf Jun 26 '16 at 22:55
2

The find command allows you to limit what files are matched. You can then call your script with the exec option e.g.

find . \( -name '*.mp3' -o -name '*.avi' \) -exec /path/to/your/script.sh

Now your script will be called for each mp3/avi file in the tree.

A simple test to show this would be to have script.sh read something like

#!/bin/bash
echo Script called with "$1" as the filename

Now you can build your script to call ffmpeg or whatever you like.

  • Stephen Harris - I would have bet my bottom dollar that I tried this one, but I changed the mp3 to mp4 as I knew there were some in there somewhere and it worked. A little inelegant perhaps, but most of the extensions I was planning on including were only possibilities, and along with a few other changes I have planned I can limit the likely ones to about six. Thanks for the help. I'll mark it solved. – Terry Romphf Jun 26 '16 at 23:03
  • Stephen Harris - I should also point out that I used mv {} ./ \; instead of path/to/script...Thanks again for taking the time to help me. – Terry Romphf Jun 26 '16 at 23:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.