FolderItem.Length <> Get Info

Probably a dumb question, but I’m wondering how to get a FolderItem.Length value that matches what the macOS Finder (Catalina) reports.

For a garden-variety JPG file, here are the various values I get:

Finder Get Info: 690,616
Shell ls: 632,108
Xojo f.Length: 660,138
MBS LogicalFileDataLengthMBS: 660,138
MBS LogicalFileResLengthMBS: 58,499
MBS LogicalFileTotalLengthMBS: 718,637
MBS PhysicalFileDataLengthMBS: 1,048,576
MBS PhysicalFileResLengthMBS: 59,392
MBS PhysicalFileTotalLengthMBS: 1,107,968

I get that the MBS “Physical” values refer to block sizes rather than file sizes, so I’m not worried about those. But is there some mapping from Get Info to Xojo that would yield the same values as the Finder reports?

Xojo 2021r1.1

Have you tried asking Finder via Apple Script?

And Finder may use 1000 instead of 1024 for Kilobytes, which can confuse people.

Thanks Christian. I’ve not tried AppleScript, but I will.

And I’m just looking at the size in bytes, so the whole MB vs MiB thing doesn’t come into play.

Make sure you’re looking at the file size that’s in parentheses in the Finder Get Info window. Length should match that.