[fpc-pascal] Getting size of file without opening it?

Bo Berglund bo.berglund at gmail.com
Fri Jul 24 00:19:32 CEST 2020


I am using FindAllFiles in order to list the files in a directory and
it works fine.

But I also need the size and timestamp of the file so I searched the
net for it.

What I found was:

var T: TDateTime;
T := FileDateTodateTime(FileAge(filename));

But FileSize() needs a file argument to an open file!

This is not what I want, I may not even be allowed to open the file.

So is there a *cross-platform* way to retrieve the size of the files
too?


-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list