• 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: Size of a bundle (or directory)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Size of a bundle (or directory)


  • Subject: Re: Size of a bundle (or directory)
  • From: Christopher Corbell <email@hidden>
  • Date: Thu, 27 Mar 2003 12:30:20 -0800

This NSFileManager approach appears to just give the same results
as
ls -l
on a directory; it gives the size of the directory record itself, it does not
include the size of its contents. NSFileManager (like the shell) appears
to treat a bundle as just another directory.

Does one really have to iterate through all of the bundle's contents
to get the total size? The finder sometimes lags when calculating a large
directory size so I suspect this, but on the other hand I've
never seen a lag when getting info on a bundle, even when the
bundle was fairly large... so I was hoping there was a nice API
for this somewhere...

Thanks for any more suggestions,
Christopher

On Thursday, March 27, 2003, at 11:05 AM, Brian Ganninger wrote:

NSFileManger is probably your best bet to get the information you're looking
for.

NSDictionary *dictionary = [[NSFileManager defaultManager]
fileAttributesAtPath:bundlePath traverseLink:NO];

NSNumber *bundleSize = [dictionary objectForKey:NSFileSize];

This is untested but should work or give a close stab at getting there.

Hope this helps.

- Brian Gannigner

On 3/27/03 12:34 PM, "Christopher Corbell" <email@hidden>
wrote:

Given an NSBundle (created with a known path), does anyone know
of an easy way to determine its total size?

I haven't been able to find this either in the NSBundle API or in
any POSIX api (total size of a directory's contents).

It's easy to Get Info for this information in the Finder, but I'd
like to be able to programatically get a number or, at least, a
line of text from the shell.

Thanks for any help,
Christopher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


----
" An Apple a day keeps the PC away."
" Ever notice that Apples fall from the sky while computers get thrown out
Windows?"
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Size of a bundle (or directory) [A: du -k -s]
      • From: Christopher Corbell <email@hidden>
References: 
 >Re: Size of a bundle (or directory) (From: Brian Ganninger <email@hidden>)

  • Prev by Date: Position of the mouse
  • Next by Date: Re: Position of the mouse
  • Previous by thread: Re: Size of a bundle (or directory)
  • Next by thread: Re: Size of a bundle (or directory) [A: du -k -s]
  • Index(es):
    • Date
    • Thread