Problem in identifying an archived file in Windows

Gabriel Genellina gagsl-py2 at
Wed Feb 25 03:19:19 EST 2009

En Wed, 25 Feb 2009 05:40:22 -0200, venu madhav <venutaurus539 at>  

>            I am writing an application which has to identify the
> archived files in a given directory.I've tried using the function
> i = win32api.GetFileAttributes (full_path)
> to obtain the attributes.But am unable to identify based on the value
> it returns as it is returning 5152, 13856 etc for different files but
> all of them are archived. Is there any way to come to a conclusion
> using these numbers about whether a file is archived or not.

So you're using the pywin32 package. It comes with a help file  
(PyWin32.chm), you can open it right from the menu: Start, All Programs,  
Python XX, Python for Windows documentation.
Go to the GetFileAttributes topic. It says "The return value is a  
combination of the win32con.FILE_ATTRIBUTE_* constants". Ok, which  
constants? Let Python tell us:

py> import win32con
py> [name for name in dir(win32con) if name.startswith("FILE_ATTRIBUTE_")]

What do they mean? The best source is the Microsoft site. There is a very  
convenient link in the help topic: "Search for GetFileAttributes at msdn,  
google or google groups." Click on msdn, the first result is  
You apparently are looking for FILE_ATTRIBUTE_ARCHIVE.

Gabriel Genellina

More information about the Python-list mailing list