?
Solved

Get attributes and created  of Folder

Posted on 2004-10-12
2
Medium Priority
?
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 200 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 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