Retrieves file information for the specified file
#include <WinAPIFiles.au3>
_WinAPI_GetFileInformationByHandle ( $hFile )
$hFile | Handle to the file that contains the information to be retrieved. |
Success: | The array containing the following information: [0] - The file attributes (FILE_ATTRIBUTE_*). [1] - $tagFILETIME structure that specifies when a file or directory is created. [2] - $tagFILETIME structure that specifies the last time that a file is read from or written to. [3] - $tagFILETIME structure that specifies the last time that a file is written to. [4] - The serial number of the volume that contains a file. [5] - The file size. [6] - The number of links to this file. [7] - The unique identifier that is associated with a file. |
Failure: | Sets the @error flag to non-zero, call _WinAPI_GetLastError() to get extended error information. |
Search GetFileInformationByHandle in MSDN Library.
#include <Date.au3>
#include <WinAPIFiles.au3>
#include <WinAPIHObj.au3>
Local $hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 0, 6)
Local $aInfo = _WinAPI_GetFileInformationByHandle($hFile)
If IsArray($aInfo) Then
For $i = 1 To 3
If IsDllStruct($aInfo[$i]) Then
Local $tFILETIME = _Date_Time_FileTimeToLocalFileTime($aInfo[$i])
$aInfo[$i] = _Date_Time_FileTimeToSystemTime($tFILETIME)
$aInfo[$i] = _Date_Time_SystemTimeToDateTimeStr($aInfo[$i])
Else
$aInfo[$i] = 'Unknown'
EndIf
Next
ConsoleWrite('!Path: ' & _WinAPI_GetFinalPathNameByHandle($hFile) & @CRLF)
ConsoleWrite('!Attributes: 0x' & Hex($aInfo[0], 8) & @CRLF)
ConsoleWrite('!Created: ' & $aInfo[1] & @CRLF)
ConsoleWrite('!Accessed: ' & $aInfo[2] & @CRLF)
ConsoleWrite('!Modified: ' & $aInfo[3] & @CRLF)
ConsoleWrite('!Volume serial: ' & $aInfo[4] & @CRLF)
ConsoleWrite('!Size: ' & $aInfo[5] & @CRLF)
ConsoleWrite('!Links: ' & $aInfo[6] & @CRLF)
ConsoleWrite('!ID: ' & $aInfo[7] & @CRLF)
EndIf
_WinAPI_CloseHandle($hFile)