File Attribute Constants:
http://msdn.microsoft.com/en-us/library/windows/desktop/gg258117%28v=vs.85%29.aspx
This document also lists FILE_ATTRIBUTE_OFFLINE 4096 (0x1000) that I’m interested in.
I can get this attribute with:
And then combining it with FILE_ATTRIBUTE_OFFLINE (0x00001000) using bitwise operator tells whether the file is offline or online:
Other file properties like readonly, system, hidden can also be obtained by combining appropriate constants with the file attribute field.
The follow code demonstrate the use of this field in getting different file properties:
It gave me following results:
file: D:\MyDir\ac.pdf
------------------
lastModifiedTime: 2014-01-16T06:56:00Z
lastAccessTime: 2014-04-16T13:56:11.674773Z
isSymbolicLink: false
size: 927608
system: false
fileKey: null
isDirectory: false
hidden: false
isOther: false
isRegularFile: true
creationTime: 2014-04-16T13:56:11.674773Z
attributes: 33
archive: true
readonly: true
------------------
dos:attributes: 33
offline: false
online: true
readonly: true
hidden: false
system: false
directory: false
archive: true
You can see I am able to correctly translate attributes field to get different file properties.
Now only if I am able to set/modify the file attributes field (basically only interested in offline/online flag) that would be great.
Thanks.