has anyone dealt with this. i couldn’t find anything via a search…
When getting the size of a folder, the finder takes a few seconds to calculate, but the result is returned regardless.
choose folder myFolder
get size of folder myFolder
yelds. missing value the first time, and if reexecuted, the proper value.
as a workaround, I did:
repeat -- we should add escape clause
set folderSize to size of folder theFolder
if folderSize is not equal to missing value then exit repeat
end repeat
but now I have a different problem, In the interim I have code that may or may not delete files from that folder. A “get size of folder” immediately after that sometimes does not reflect the changes until it finishes recalculating, so I can’t trust it to represent the size of the folder after deletion of files.
Is there a way for me to have it pause until it accurately recalculates the folder size, as it seems to be returning whatever you would see in the get info window, which sometimes takes a while to update, especially for a large nested tree of files.
While it’s recalculating, I get a return value of 0, which is a valid possibility, so I couldn’t trust it as a flag. Nor could I trust a time-out, because large folders could take a while.
any other suggestions ? I t sounds like a bug to me in applescript.
I don’t think it’s the fault of AppleScript but of the Finder. Maybe ‘info for’ (Standard Additions) will be quicker/more reliable. This does not need to be (and probably shouldn’t be) within a Finder tell block.