• 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: Getting the "real" file size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the "real" file size


  • Subject: Re: Getting the "real" file size
  • From: Nicholas Riley <email@hidden>
  • Date: Mon, 30 Jun 2003 19:02:53 -0500
  • Mail-followup-to: Bryan Lund <email@hidden>, email@hidden

On Mon, Jun 30, 2003 at 06:46:35PM -0500, Nicholas Riley wrote:
> On Mon, Jun 30, 2003 at 04:17:55PM -0700, Bryan Lund wrote:
> > I am attempting to get the size of a file using something akin to the
> > following :
> >
> > NSNumber *fsize;
> > NSFileManager *manager = [[NSFileManager alloc] init];
> > NSDictionary *fattrs = [manager fileAttributesAtPath:[@"path to file"]
> > traverseLink:NO];
> > fsize = [fattrs objectForKey:NSFileSize];
> >
> > However NSFileSize returns the file size that you get when you do an
> > "ls -l" in the terminal...not the file size as reported by the Finder.
> > Oftentimes these sizes are quite different.
> >
> > Is there any way to retrieve the file size for a file so that it
> > matches what is seen in the Finder?
>
> Yes, use FSGetCatalogInfo - you'll see fields in the FSCatalogInfo structure
> which correspond to

Whoops, I swear I wrote something here! That should be:

...which correspond to the file sizes shown in the Finder. The Finder
combines the data and resource fork sizes into one; you can get them
individually from FSCatalogInfo.

--
=Nicholas Riley <email@hidden> | <http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
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.

References: 
 >Getting the "real" file size (From: Bryan Lund <email@hidden>)
 >Re: Getting the "real" file size (From: Nicholas Riley <email@hidden>)

  • Prev by Date: Re: Getting the "real" file size
  • Next by Date: Re: subclass weirdness
  • Previous by thread: Re: Getting the "real" file size
  • Next by thread: Saving preferences tutorial
  • Index(es):
    • Date
    • Thread