determine file type

Mark Gibson mark at gibsonsoftware.com
Sun Mar 26 19:13:40 EST 2006


Is there an equivalent to the unix 'file' command?

[mark tmp]$ file min.txt
min.txt: ASCII text
[mark tmp]$ file trunk
trunk: directory
[mark tmp]$ file compliance.tgz
compliance.tgz: gzip compressed data, from Unix

What I really want to do is determine if a file is 1) a directory, 2) a 
text file 3) a binary file.

Is there a way to do this?

Mark



More information about the Python-list mailing list