LiamP
(LiamP)
September 30, 2025, 9:57pm
1
I have the following code in a Method on a Window:
fiFile = GetFolderItem(oLrC.Path)
if fiFile.Exists then
lblFileLocated.Text = kCheckMark
tfFileSize.Text = fiFile.Length.ToString
end if
Since I haven’t executed a ShowOpenFileDialog it returns 0.
Is there a way to get the file size without going through a dialog?
thanks
Is the file “cloud” based and needs to be downloaded, whcih the open file dialog would be doing for you?
You could use binarystream to open the file & report the length from that.
1 Like
LiamP
(LiamP)
September 30, 2025, 10:21pm
4
It is on Dropbox right now but I need to code to work on a local disk. I’m just testing now.
LiamP
(LiamP)
September 30, 2025, 10:22pm
5
Great, I’ll have to research how to do this but I’m sure it’s documented.
Thanks
LiamP
(LiamP)
September 30, 2025, 10:22pm
6
It is on Dropbox right now but I need to code to work on a local disk. I’m just testing now.
If it is on dropbox, and is online only, the file will exist but be 0 bytes locally. Download the file locally through dropbox and try again.
1 Like
Also are you pointing to a “bundle” eg an app on macOS. These are folders and would be 0 bytes
1 Like
FWIW, I don’t see this. I am using Dropbox on File Provider . Online-only files showing the “Not Downloaded” icon in Finder correctly report their size. This is visible via ls -l
in Terminal and FolderItem.Length
in Xojo. It of course hasn’t been downloaded, but it does have the metadata for length that it is providing via the File Provider API.
1 Like
Consider using a shell command..
dir *.log > filelist.txt
After that, a text file will exist containing file names and length.
You can open that and read line by line.
12/20/2023 03:08 PM 2,871 regwizard.log
12/30/2023 05:34 PM 27,646 sanct.log
Var F As new FolderItem(SpecialFolder.Desktop.Child("MyPicture.jpg"))
Messagebox(F.Length.ToString)
This will work.The file must exist though for the messagebox to work…No need for a FileOpenDialog.
Is your app sandboxed? If yes, macOS will not grand you access unless you select the file with a fileopendialog.
1 Like
LiamP
(LiamP)
October 2, 2025, 5:52pm
13
I have copied the same file from DropBox to my Desktop and it works fine.
thanks everyone