File attributes

Larry Bates larry.bates at websafe.com
Mon May 22 18:50:18 EDT 2006


acatejr at gmail.com wrote:
> I know how to "walk" a folder/directory using Python, but I'd like to
> check the archive bit for each file.  Can anyone make suggestions on
> how I might do this?  Thanks.
> 
You must have Mark Hammond's win32 package installed, then you can
(barely tested):

import win32api
import win32con

fattrs=win32api.GetFileAttributes(filename)
if fattrs & win32con.FILE_ATTRIBUTE_ARCHIVE:
    #
    # Archive bit set
    #

-Larry Bates



More information about the Python-list mailing list