Finding the attributes of a file

V

venutaurus539

Hello all,
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.

Thanks in advance,
Venu
 
J

John Machin

Hello all,
           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.

Two questions:
(1) What didn't you understand on the MSDN page that comes up when you
fed "GetFileAttributes" into your googler and selected the first hit?

"""
The attributes can be one or more of the following values.
Return code/value Description

[... and the very first one is ...]

FILE_ATTRIBUTE_ARCHIVE
320x20

A file or directory that is an archive file or directory.

Applications use this attribute to mark files for backup or removal.
"""

Sure it slows you down slightly by having to mentally insert the
missing space in "320x20", but sheeeeesh it's not that hard to find.

(2) Where did you get the idea that this bit means archivED (i.e
completed, past tense)? AFAIK it's always been documented the MSDN
page says, with a hopeful or future-tense meaning. Of course as long
as the setters of the bit and the getters of the bit are using the
same protocol, it's not a problem ... could be a bit of a problem
ensuring you know who all the getters and setters are, and ensuring
that they are under your control.

HTH,

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top