I have a Python script, filetype.py, that takes a file name as a parameter. I use the script to identify if a file with a .bin extension is actually a Microsoft Visio or PowerPoint file. I run the script on an OS X system from a Terminal window where I have a Bash shell prompt. E.g.:
$ ~/Documents/bin/filetype.py oleObject1.bin Microsoft Office PowerPoint $
But I often want to have it check all of the .bin files in a directory. You can loop through all files in a directory or a set of files using a Bash for loop. E.g., to check all of the .bin files in a directory I could use the for-loop below:
$ ls * oleObject1.bin oleObject3.bin oleObject5.bin oleObject2.bin oleObject4.bin oleObject6.bin $ for f in *.bin; do ~/Documents/bin/filetype.py $f; done Microsoft Office PowerPoint Microsoft Office PowerPoint Microsoft Office PowerPoint Microsoft Visio Microsoft Visio oleObject6.bin: CDF V2 Document, No summary info $
[ More Info ]