win32file.GetFileAttributesEx
tuple = GetFileAttributesEx(filename, level
)
Retrieves attributes for a specified file or directory.
Parameters
filename : string/unicode
String that specifies a file or directory.
Windows NT/2000: In the ANSI version of this function, the name is limited to
MAX_PATH characters. To extend this limit to nearly 32,000 wide characters,
call the Unicode version of the function (win32file::GetFileAttributesExW) and prepend
"\\?\\" to the path.level=GetFileExInfoStandard : int
An integer that gives the set of attribute information to obtain.
See the Win32 SDK documentation for more information.
Comments
Not all file systems can record creation and last access time and not all file systems record
them in the same manner. For example, on Windows NT FAT, create time has a resolution of
10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution
of 1 day (really, the access date). On NTFS, access time has a resolution of 1 hour.
Furthermore, FAT records times on disk in local time, while NTFS records times on disk in UTC,
so it is not affected by changes in time zone or daylight saving time.
Return Value
The result is a tuple of:
Items
- [0] int : attributes
- File Attributes. A combination of the win32com.FILE_ATTRIBUTE_* flags.
- [1] PyTime : creationTime
- Specifies when the file or directory was created.
- [2] PyTime : lastAccessTime
- For a file, specifies when the file was last read from
or written to. For a directory, the structure specifies when the directory was created. For
both files and directories, the specified date will be correct, but the time of day will
always be set to midnight.
- [3] PyTime : lastWriteTime
- For a file, the structure specifies when the file was last
written to. For a directory, the structure specifies when the directory was created.
- [4] int/long : fileSize
- The size of the file. This member has no meaning for directories.