From: freter@nordakademie.de (Freter) Subject: Re: GetFileSize API Date: 16 Jun 1999 00:00:00 GMT Message-ID: <8DE7AC12Ffreternordakademiede@forums.inprise.com> References: <3767BB86.77C1718@idsc1.gov.eg> Organization: FH Nordakademie User-Agent: Xnews/2.06.11 Newsgroups: borland.public.delphi.winapi Hi Hammady, if you would like to have a full blown function for determining the file or directory size (recursively), you can use this one: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> function GetFileSize(AFile: string): integer; var SearchRec: TSearchRec; begin Result := 0; if ( FindFirst(AFile, faAnyFile, SearchRec) = 0 ) then begin if ( (SearchRec.Attr and faDirectory) <> faDirectory ) then begin // it is a normal file Result := SearchRec.Size; FindClose(SearchRec); end else begin // it is a Directory FindClose(SearchRec); if ( FindFirst(AFile + '\*.*', faAnyFile, SearchRec) = 0 ) then repeat if ( (SearchRec.Name <> '.') and (SearchRec.Name <> '..') ) then Result := Result + GetFileSize(AFile + '\' + SearchRec.Name); until ( FindNext(SearchRec) <> 0 ); end; end; end; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< rgds, Hammady mhammady@idsc1.gov.eg wrote in <3767BB86.77C1718@idsc1.gov.eg>: [...] > How i can use the GetFileSize API? asking this because FileSize > function >od IO unit in D3 requires that i must Assign the file to local >memory variable.. which is not applicable when another software is >oppening this file!! [...]