Take the 2-minute tour ×

I'm trying to move video files to directory by width of that video file.

For example I have


After running script


If I run script again another width directory is not created.

  • Match common video extensions
  • Do not match if file's parent directory is only digits (because that's the width)

I've come up with this so far but it doesn't work:

find . -type f \( -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.wmv" -o -iname "*.mp4" \) -a -regex '.*\/[^0-9]+\/\.*$' -exec bash -c 'echo "Processing {} .."; WIDTH=$(mediainfo "--Inform=Video;%Width%" "{}") && DIR=$(dirname "{}") && mkdir -p "$DIR/$WIDTH" && mv "{}" "$DIR/$WIDTH"' \; 
share|improve this question
Glad were here to help you organize your pr0n 8-). –  slm Jan 30 '13 at 22:50
add comment

1 Answer

I found your question: use ffmpeg -i YOUR_MOVIE_FILES -sample_fmts You get the long data.

You must use a true grep to retrieve resolution. in this data you can find resolution.

ffmpeg -i YOUR_MOVIE_FILES -sample_fmts |egrep blahblah

or use a awk script.

share|improve this answer
add comment

Your Answer


