I am trying to get the properties for files in a directory, and I have problems with applications. Since applications are in fact directories, their url.resourceValues(forKeys:)
for different size-related keys return nil
, zero or 96 bytes.
To calculate the application size, I'm doing what I would do with any normal directory, recursively enumerating it using this code: How can I calculate the size of a folder?
However, even though this code is relatively fast, it still takes about 30 seconds to display all the sizes in my Applications directory.
Almost all the file managers I've seen display this information momentarily, so there must be a way to know the total application size without traversing its subdirectory structure, but I cannot find anything that would help me in the docs. What am I missing?