win32file.SetFileInformationByHandle

SetFileInformationByHandle(File, FileInformationClass, Information)

Changes file characteristics by file handle

Parameters

File : PyHANDLE

Handle to a file or directory. Do not pass a pipe handle.

FileInformationClass : int

Type of data, one of win32file.File*Info values

Information : object

Type is dependent on the class to be changed

Class Type of input
FileBasicInfoDict representing a FILE_BASIC_INFO struct, containing {"CreationTime":PyTime, "LastAccessTime":PyTime, "LastWriteTime":PyTime, "ChangeTime":PyTime, "FileAttributes":int}
FileRenameInfoDict representing a FILE_RENAME_INFO struct, containing {"ReplaceIfExists":boolean, "RootDirectory":PyHANDLE, "FileName":str} MSDN says the RootDirectory is "A handle to the root directory in which the file to be renamed is located". However, this is actually the destination dir, can be None to stay in same dir.
FileDispositionInfoBoolean indicating if file should be deleted when handle is closed
FileAllocationInfoInt giving the allocation size.
FileEndOfFileInfoInt giving the EOF position, cannot be greater than allocated size.
FileIoPriorityHintInfoInt containing the IO priority (IoPriorityHint*)

Comments

Available on Vista and later.

Accepts keyword args.