How to inventory unique file types within a directory

Started by remarkableearth, December 05, 2017, 02:23:59 PM

Previous topic - Next topic

remarkableearth

My directory tree has thousands of images of dozens of file types, some of which exiftool can read/write/create and some it cannot.

I'd like to take an inventory of the unique file types within the directory and all its subdirectories. I've searched this forum and a general google search for "exiftool inventory file types" and "exiftool survey file types" and the only thing I found which seems promising is -listf. I'll keep looking and trying things, but in the meantime, can you help?

StarGeek

Does it need to specifically be file types that exiftool can read or all types available?  Do some of the files have incorrect extensions?

I think this might be better handled outside of exiftool.  For example, this SuperUser answer has a BAT file for Windows.  I also see unix type answers as well.  As long as you don't need to inspect each file to make sure of the filetype, this seems like a quicker and more efficient answer.

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

remarkableearth

Indeed, StartGeek.

As you were responding, I found this script on StackOverflow that does the job: find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u, found here: https://stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy. As you said, more easily accomplished outside of exiftool.

Thank you.

StarGeek

Yep, I found that one as well, but wasn't sure what OS you were using.  Since I'm on Windows, I decided to test out the Windows version.  That one is not very fast when run on a very large (100,000+ files) directory.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype