DelphiFAQ Home Search:
General :: Windows :: Programming :: Windows with Delphi :: Windows Filesystem
File related questions and answers. File operations, attributes, system dialogs, hard disk handling.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

Touch for Windows in Delphi

Do you need the unix touch utility for Windows? You can write it in Delphi.
This example also shows how to use the functions FindFirst, FindNext and FindClose.

You can download the source and EXE file.

{$APPTYPE CONSOLE}
 program touch;
 
 uses
   SysUtils;
 
 {$R *.RES}
 
 procedure SetFileDate(TheFileName: string; aDate: TDateTime);
 var
   f: Integer;
 begin { SetFileDate }
   f := FileOpen(TheFileName, fmOpenReadWrite);
   try
     FileSetDate(f, DateTimeToFileDate(aDate));
   finally
     FileClose(f)
   end { try }
 end; { SetFileDate }
 
 var
   f: TSearchRec;
   dtTarget: TDateTime;
 
 begin
   dtTarget := Now;
   try
     if FindFirst(paramstr(1), 255, f)=0 then
       repeat
         writeln(f.Name);
         SetFileDate(f.Name, dtTarget);
       until FindNext(f)<>0;
   except
     FindClose(f);
   end; { try }
 end.
You don't like the formatting? Check out SourceCoder then!
Generated 8:03:22 on Oct 21, 2018