On Sep 5, 2009, at 7:47 AM, Doug Tallman wrote: Curiously, if you ask for a folder's size via Finder's properties, it appears you get "missing value." But the size is available by calling "info for ..." Is this a bug, or a sign that we should rewrite scripts that are dependent on Finder properties?
I just wrote, without thinking ...
tell application "Finder" if (get free space of diskAlias) - (get physical size of sourceFolder) < 10000000 then "There is not enough free space on the disk \"" & (name of diskAlias) & "\"." display dialog the result buttons {"Cancel"} default button 1 end if end tell
It seemed to work just as it's supposed to, no problems. Then I remembered this recent post. I checked that perhaps the folder needed to be updated first, so I tried this script ...
set sourceFolder to alias "Work_Files:TESTING:AppleScriptUsersTEST" tell application "Finder" update folder sourceFolder display dialog (get physical size of sourceFolder) buttons {"Cancel"} end tell
In some instances, it gave an incorrect result, but the last few runs gave correct results. If a few of us experiment with this, perhaps we can discover something, here.
|