Re: Getting the "real" file size
Re: Getting the "real" file size
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.