osx - Calculating size of Mac OS directory with resource forks without using deprecated functions -


I would like to calculate the directory size and all its contents all solution that I came to use either NSFileManager (which uses time not take resource fork) or dislikes functions calculate the file size.

Now how should we get an exact folder size using coco?

I solved it:

  - (unsigned long long ) folder SizeForURL: (NSURL *) url {NSArray * keys = @ [NSURLTotalFileSizeKey]; NSDirectoryEnumerator * enumerator = [[NSFileManager defaultManager] enumeratorAtURL: Proprtijforkijh including URL: Keys option: 0 Trutihandlr: ^ (ns URL * url, NSError * error) Gnn after placing {// error handle // Return Yes, if the error Should continue. Yes come back }]; Unsigned long long size = 0; (Url in NSRR * enumerator) {NSError * error; NSNumber * Total file size; [Url getResourceValue: & amp; Key file size: NSURLTotalFileSizeKey error: & amp; Error]; Size + = [totalFileSize longLongValue]; } The size of the return; }  

The result is similar to the finder.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -