Qu1nto
9/6/2018 - 7:21 AM

[FileSize] Get size of a file #File

[FileSize] Get size of a file #File

// Returns the size of a file in bytes; the function returns -1 if the file was not found.
function FileSize(fileName : wideString) : Int64;
var
	sr : TSearchRec;
begin
  if FindFirst(fileName, faAnyFile, sr ) = 0 then
	  result := Int64(sr.FindData.nFileSizeHigh) shl Int64(32) + Int64(sr.FindData.nFileSizeLow)
  else
  	result := -1;
    
  FindClose(sr);
end;