• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
getting the size of a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting the size of a folder


  • Subject: getting the size of a folder
  • From: Peter Schols <email@hidden>
  • Date: Sun, 3 Feb 2002 16:20:47 +0100

Hi,

I'm looking for the fastest way to get the size of a folder (including all subfolders). I'm trying to use NSDirectoryEnumerator, but it doesn't return a correct value:

NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager] enumeratorAtPath:@"/Users/mac/Pictures"];
NSNumber *folderSize;
NSDictionary *fattrs = [direnum directoryAttributes];
if (folderSize = [fattrs objectForKey:NSFileSize])
NSLog(@"File size: %d\n", [folderSize intValue]);

What am I doing wrong?
Thanks!

Peter


  • Prev by Date: Re: Is there a way to draw on the Menubar?
  • Next by Date: Re: Using NSApplication.endSheet() in the Java API
  • Previous by thread: Cocoa documentation on my site
  • Next by thread: Simple TableView App (problem)
  • Index(es):
    • Date
    • Thread