• 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
Re: Number of Files on Volume
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Number of Files on Volume


  • Subject: Re: Number of Files on Volume
  • From: Joe Turner <email@hidden>
  • Date: Wed, 26 Nov 2008 09:24:32 -0600

Thanks :)

As long as I know it will not be deprecated anytime soon, I will use it :)

Cheers!
On Nov 26, 2008, at 9:19 AM, Jean-Daniel Dupas wrote:


Only the HIToolbox will be discontinued. All others API are already available in 64 bits app.


IMHO Apple is neither going to remove the CoreServices File Manager nor even mark it deprecated (before at least Mac OS 11 or 12).
There is no Cocoa API to efficiently access the File System.


And if you want do not want to use the File Manager, you will have to use the Darwin way, which is far more complex (and use under the hood by the File Manager).
Have a look at getattrlist() and the ATTR_VOL_FILECOUNT attribute (the man page provide a sample that show how to retreive the file count).



Le 26 nov. 08 à 15:53, Joe Turner a écrit :

I'm just worried that it will be deprecated soon with the release of Snow Leopard; it is Carbon.
Second, I just wanted to see if there was an easy Cocoa way; the CoreServices way works fine.
On Nov 26, 2008, at 8:51 AM, Jean-Daniel Dupas wrote:


Just a question, what was wrong with the CoreServices way ? (ie using FSGetVolumeInfo).

Le 26 nov. 08 à 15:19, Joe Turner a écrit :

Okay, maybe I spoke too soon... It worked twice. To get the number of files, I am doing this now:

- (NSNumber *)fileCount
{
NSDictionary *attributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath:path];
return [NSNumber numberWithDouble:
([[attributes objectForKey:NSFileSystemNodes]
doubleValue] - [[attributes objectForKey:NSFileSystemFreeNodes]
doubleValue])];
}



The first two times I got the right number (752339), but now I am getting 18749375. Is this way even supposed to work?


Thanks!



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Re: Number of Files on Volume (From: Graham Lee <email@hidden>)
 >Re: Number of Files on Volume (From: Joe Turner <email@hidden>)
 >Re: Number of Files on Volume (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Number of Files on Volume (From: Joe Turner <email@hidden>)
 >Re: Number of Files on Volume (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: to get handle to "File/1.jpg"
  • Next by Date: Re: to get handle to "File/1.jpg"
  • Previous by thread: Re: Number of Files on Volume
  • Next by thread: How to use IB to create a viewcontroller which actually linking to another nib file?
  • Index(es):
    • Date
    • Thread