Hello.
I’m trying to make a script that will give me a list of folders (within a parent folder) with thier sizes in GB’s.
set childFolders to {} as list
set entrySize to ""
tell application "Finder"
activate
set childFolders to (every folder of alias "Volume:TheParentFolder:")
repeat with anEntry in childFolders
set entrySize to size of anEntry
set entrySize to (entrySize / 1024)--errors highligting 1024
set entrySize to (entrySize / 1024)
set entrySize to (entrySize / 1024)
set entrySize to (round (entrySize * 100)) / 100
display dialog entrySize
end repeat
end tell
When I run this, the first time through the repeat everything works fiine. On the second run through I get a an applescript error that says “Can’t make missing value in real” (see code above)
Then, I thought I’d add a repeat while entrySize is “” to wait while maybe the script could get the file size. I’d heard that sometime this happens with AS and OS X.
set childFolders to {} as list
set entrySize to ""
tell application "Finder"
activate
set childFolders to (every folder of alias "Volume:TheParentFolder:")
repeat with anEntry in childFolders
repeat while entrySize is ""
set entrySize to size of anEntry
end repeat
set entrySize to (entrySize / 1024)
set entrySize to (entrySize / 1024)
set entrySize to (entrySize / 1024)
set entrySize to (round (entrySize * 100)) / 100
display dialog entrySize as text
end repeat
end tell
When I run this, the first time through the repeat display dialog works fine. But when the second and successive times through, the return is 0 for all folders.
Sorry for the long post. Any help is appreciated!
Browser: Firefox 1.5
Operating System: Mac OS X (10.4)