Believe it or not, even for me, speed isn’t everything But I’m sure there are apps still using it. I used it in early versions ASObjC Runner, and when I changed to the Cocoa method after 10.8, it was definitely slower. This was always the fastest way, and when Apple deprecated it in 10.8, there were many developers who complained that there was no Cocoa method that was so fast. I suspect it uses a Carbon function called FSGetCatalogInfoBulk(). In fact, I’m not surprised it’s the fastest method. It’s not a warning that it’s a slow method per se, rather that it can take some time for large folders, and therefore it’s quickest to exclude it unless size is the thing you’re actually after. In spite of Apple’s warning that info for will be slow in getting the size of large folder, I have found it is the fastest method I know of. Set itemSize to (first word of itemSizeStr) as number Set itemSizeStr to (do shell script cmdStr) Set cmdStr to "du -s /users/jimunderwood" Which should we believe?įor complete reference here’s my shell script: Bash du Script Which is the Correct Size ?Įach method returns a different size. It returns a proper positive number for all other folders. System Events is returning a NEGATIVE size for my users folder, and the ~/Documents folder Set itemAlias to (POSIX file itemPath) as alias Set itemPath to "/Users/jimunderwood" # CHANGE to Your Users folder, or other large folder System Events Script use AppleScript version "2.5" - El Capitan (10.11) or later Set itemSize to size of (get info for itemPath) Set itemPath to "/Users/jimunderwood" # CHANGE to your folder, or any LARGE folder Here are my test scripts: info for Script use AppleScript version "2.5" - El Capitan (10.11) or later So, in spite of Apple’s warning that info for will be slow in getting the size of large folder, I have found it is the fastest method I know of. I also tried this on my large DropBox account which has thousands of files, and got similar results. I found comparable times when running from Script Debugger 6.0.7 (6A217) on macOS 10.11.6.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |