osx - Objective-C - Finding directory size without iterating contents -
I have to find out the size of a directory (and its sub-directory). I can do this again through the Directory Tree and I can summarize the file sizes. There are many examples on the Internet, but it is somewhat difficult and slow process, especially when looking at the unchanging large directory structures.
I notice that Apple's Finder application can show a directory size immediately for a given directory. This means that the operating system keeps this information in real-time. However, I am unable to determine how to use this information. Does anyone know where this information is stored and if it can be obtained from Objective-C application?
IIRC finder also repeats in the old days, to quickly do this FSGetCatalogInfo (an old File manager call) I think that there is a new POSIX call for it, these days it is the fastest, lowest level API, especially if you are not interested in all information other than size and really easy Need to speed up the speed on the code to maintain Shayakata.
He said, if it has been cached somewhere in a publicly accessible area, then it is probably a spotlight, have you checked whether the spotlight information for the folder contains its size?
PS - Remember one important thing when determining the size of a file: two "forks", data fork, and resource fork in the Mac files (where the searcher knows for example, if you have any To open special files with the second app from the default to their file type and override the specified custom icons for files). So make sure you add both the size of the fork, or your measurement will be closed.
Comments
Post a Comment