seperating directories from files

Fuzzyman fuzzyman at gmail.com
Mon Jan 30 12:56:23 CET 2006


For checking the contents of a directory :

for entry in os.listdir(this_dir):
     if os.path.isdir(os.path.join(this_dir, entry));
        continue

You could use splitext to get the extension of a the filename, and
*assume* that '.jpg', '.png', '.ico' and friends are images.

I'm sure PIL will have ways of checking image metadata (if this is all
you are specifically after here).

All the best,


Fuzzyman
http://www.voidspace.org.uk/python/index.shtml




More information about the Python-list mailing list