visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Delphi :: Knowledge Base : How to get a directory size in bytes ? Pascal or Delphi, Windows, DOS


By: VGR France  Date: 21/03/2005 08:40:16  English  Points: 0 Status: Answered
Quality : Good
Dated 06/06/2003

You may not need to include (uses clause) the Windows unit in source ; you need to adapt directory to come from a Directory choosing dialog, or simplier to be '.' so that the actual directory is used in stead.

Program getsizedir(InPut,OutPut); {$APPTYPE CONSOLE} Uses SysUtils, Windows in 'H:\Borland\Delphi4\Source\Rtl\Win\windows.pas'; Var srec : TSearchRec; size : LongWord; Const directory = 'C:\pflash\*.*'; begin If FindFirst(directory,faAnyFile,srec)=0 Then Begin size:=0; Inc(size,srec.Size); While FindNext(srec)=0 Do Inc(size,srec.Size); SysUtils.FindClose(srec); WriteLn('size of ',directory,' is ',size,' bytes.'); End Else Writeln('Error accessing ',directory); ReadLn; end.


Do register to be able to answer

EContact
browser fav
page generated in 500.180010 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page