Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

For example I have

./xxx/pr0n.mkv
./pokemon.mkv

After running script

./xxx/1920/pr0n.mkv
./1920/pokemon.mkv

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
1  
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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