Re: Obtain directory size.
Re: Obtain directory size.
- Subject: Re: Obtain directory size.
- From: James Bucanek <email@hidden>
- Date: Fri, 20 May 2005 10:20:20 -0700
Julian wrote on Friday, May 20, 2005:
>Since NSFileManager has no capabilities of returning the size of a
>folder(a folder + contents), what would be a suitable & fast method
>for obtaining this besides enumerating as it's slow as christmas.
There isn't one.
The OS doesn't track this information, which is why there is no API to get it "in one swoop."
The quickest way of doing this, as far as I know, is to use FSGetCatalogInfoBulk to recursively fetch all of the data and resource fork lengths for every file in the subdirectory. Set the catalog info flags so the file lengths are the only information returned (since you don't care about anything else, there's no point in having FSGetCatalogInfoBulk fetch/calculate any other file info values).
--
James Bucanek <mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden