Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know this sounds like a rather simple problem but it's not!

I'm attempting to locate all the video files on a removable drive via the GUI. There might be various types of video files like avi,mpg,mov... etc. I'm not 100% sure of all the possible file types, that's why I'm going for a GUI tool rather than a terminal search command.

The drive I'm querying has a huge mass (300GB) of data spanning 10 years worth of backups, a total mess! The file type of the drive is ext4.

I've tried catfish, it worked beautifully locating the needed files but didn't have a right click copy to location feature! I've tried KDE's (4.8) nepomuk desktop search indexer, but it took way too long to index the huge mass of data and didn't complete, plus it didn't seem to have a way to only index the initial headers of the file. I also tried the latest 'Desktop Search' application on Ubuntu 12.04 but it doesn't have a file type option!

I vaguely remember various earlier flavors or Ubuntu not being able to complete the task.

Your suggestions will be greatly appreciated.

share|improve this question
add comment

1 Answer

There can't be that many file endings, can there? At least it is a finite number. I find that this task is actually exceptionally suited for terminal work.

Aside from the usual extensions

  • .avi
  • .mpg/.mpeg
  • .wmv
  • .mov
  • .mkv
  • .flv

in a case insensitive manner, you can probably get a good guess of the remaining video files by searching after all files above a certain size, perhaps excluding some usual non-video suspects such as

  • .rar
  • .zip
  • .gz
  • .mp3
  • .flac
  • .pdf
  • .doc

and so on for clarity, and refining this list if you find more problems.

I would thus iteratively do e.g.

find /my/drive -not -iregex '.*\.\(avi\|mpe?g\|wmv\|mov\|mkv\|flv\|rar\|zip\|gz\|mp3\|flac\|pdf\|doc\)' -type f -size +10M

finding more file endings that might be videos and adding them to the video extension list.

This should not take many runs (probably only one), and would be quick since the listings are cached after the first run.

Once file endings are collected, find all video files by matching on your refined extension list:

find /my/drive -iregex '.*\.\(avi\|mpe?g\|wmv\|mov\|mkv\|flv\)' -type f

Now you can directly build on this command and perform actions on all files at once, e.g. moving them to a different location, or just list them, or what you want to do. Perhaps just manually do stuff with them after making their locations known.


There are more convoluted solutions that would test the contents of all files, e.g. the file utility in combination with find and then grep:ing the result for video files, but it would be many magnitudes slower. File name extension guessing is a coarser mesh, but will probably hit all files anyway.

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.