Get a file size in Delphi ...
Posted on 2012-03-27
I need some help, i downloaded some code from the internet that will allow me to get a file size.
The Size on disk is: 9.42 GB (10,123,444,224 bytes)
This is the size its bringing back: 1533509120
This is the code im using:
function TFunctions.FileSize(FileName: string): Int64;
if FindFirst(FileName, faAnyFile, SearchRec) = 0 then // if found
//SearchRec.Size property works, but only for files less than 2GB
Result := Int64(SearchRec.FindData.nFileSizeHigh) shl Int64(32) + // calculate the size
Result := 0;
FindClose(SearchRec); // close the find
Thank you in advance.