Solved

Get attributes and created  of Folder

Posted on 2004-10-12
2
164 Views
Last Modified: 2010-04-05
Hello Experts.

 i know how get size of folder but don't know how get get attributes and created day of Folder, please teach me.
 Thanks.
0
Comment
Question by:z27
  • 2
2 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 50 total points
ID: 12295723
Hi,

For creation datetime of a folder:

function GetFileCreated(const filename: string): TDateTime;
var sr:TSearchRec;
  SysTimeStruct: SYSTEMTIME;
  lft:_FILETIME;
begin
  Result:=0; // if the file won't be found
  if FindFirst(FileName,faAnyFile,sr) = 0 then
  begin
    if FileTimeToLocalFileTime(sr.FindData.ftCreationTime, lft) and
      FileTimeToSystemTime(lft, SysTimeStruct) then begin
      result := SystemTimeToDateTime(SysTimeStruct);
    end;
  end;
  FindClose(sr);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ShowMessage(FormatDateTime('dd.mm.yyyy hh:nn:ss', GetFileCreated('c:\temp')));
end;

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
ID: 12295876
For attributes:

procedure TForm1.Button1Click(Sender: TObject);
begin
  if (GetFileAttributes(PChar(Edit1.Text)) and faReadOnly) > 0 then ShowMessage('ReadOnly');;
end;

Look TSearchRec description in Delphi help for other attribute constants like faHidden, etc..

Regards, Geo
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dev Express grid collapse 2 44
When i run adoquery my application freezes 26 165
how to change, disabled button color FMX ? 1 32
Delphi: making a BW image transparent 10 37
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question