A command to list all file formats in a directory?

rado84

Well-Known Member
Joined
Feb 25, 2019
Messages
776
Reaction score
633
Credits
4,916
Hi. Is there a command that will list all file formats found in a directory with a recursive method (meaning that it will list all file formats in subdirs as well)?
 


You could use the file command to show filetype - is that what you're looking for?
Code:
$ file movies.txt
movies.txt: ASCII text

Then, push it through the files in your directory with something like the find command..
find . -type f | file -f -
 
Last edited:
No. But after an hour of searching, I think I found the command. It doesn't have the "-r" flag but it still displays the file extensions from all the subdirs and I'm gonna make an alias of it.

Code:
find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -u
 

Staff online

Members online


Top