Title: All information about file
TWin32FindData record contains information about type of file and ExtractFileDir, ExtractFileDrive, ExtractFileExt, ExtractFileName, ExtractFilePath procedures contain information about location of the file.
procedure TForm1.Button1Click(Sender: TObject);
var
MyS: TWin32FindData;
FName: string;
MyTime: TFileTime;
MySysTime: TSystemTime;
begin
Memo1.Clear;
FName:=Edit1.Text;
with Memo1.Lines do
begin
Add('Directory - '+ExtractFileDir(FName));
Add('Drive - '+ExtractFileDrive(FName));
Add('Extension - '+ExtractFileExt(FName));
Add('File name - '+ExtractFileName(FName));
Add('Path - '+ExtractFilePath(FName));
Add('');
FindFirstFile(PChar(FName), MyS);
case MyS.dwFileAttributes of
FILE_ATTRIBUTE_COMPRESSED: Add('Attribute - File is compressed');
FILE_ATTRIBUTE_HIDDEN: Add('Attribute - File is hidden');
FILE_ATTRIBUTE_NORMAL: Add('Attribute - File has no any attributes');
FILE_ATTRIBUTE_READONLY: Add('Attribute - Read only file');
FILE_ATTRIBUTE_SYSTEM: Add('Attribute - System file');
FILE_ATTRIBUTE_TEMPORARY: Add('Attribute - File for temporary storage');
FILE_ATTRIBUTE_ARCHIVE: Add('Attribute - Archive file');
end;
MyTime:=MyS.ftCreationTime;
FileTimeToSystemTime(MyTime, MySysTime);
Add(
'Time Creation - '+
IntToStr(MySysTime.wDay)+'.'+
IntToStr(MySysTime.wMonth)+'.'+
IntToStr(MySysTime.wYear)+' '+
IntToStr(MySysTime.wHour)+':'+
IntToStr(MySysTime.wMinute));
MyTime:=MyS.ftLastAccessTime;
FileTimeToSystemTime(MyTime, MySysTime);
Add(
'Last time access - '+
IntToStr(MySysTime.wDay)+'.'+
IntToStr(MySysTime.wMonth)+'.'+
IntToStr(MySysTime.wYear));
Add('Size - '+IntToStr(MyS.nFileSizeLow));
Add('Alternate name - '+StrPas(MyS.cAlternateFileName));
end;
end;