I have ben trying to find a good way to get an accurate count of files on a Volume. Using a NSDirectoryEnumerator takes way too long (a couples minutes), so, I figured out how to do it on the old Carbon FileManager using:

FSVolumeInfo info;
FSRef pathRef;
FSCatalogInfo catInfo;
const char *inPath = [volumePath cStringUsingEncoding:NSUTF8StringEncoding];

FSPathMakeRef((UInt8 *)inPath, &pathRef, NULL);

FSGetCatalogInfo(&pathRef, kFSCatInfoGettableInfo, &catInfo, NULL, NULL, NULL);

FSGetVolumeInfo(catInfo.volume, 0, NULL, kFSVolInfoGettableInfo, &info, NULL, NULL);

self.count = [NSNumber numberWithInt:info.fileCount];

Is there a better way of doing it? Maybe with Cocoa tools?

Thanks
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to