• 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: fileAttributesAtPath, NSFileSize problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fileAttributesAtPath, NSFileSize problems


  • Subject: Re: fileAttributesAtPath, NSFileSize problems
  • From: Richard Schreyer <email@hidden>
  • Date: Sun, 19 Aug 2001 17:58:11 -0700

On Sunday, August 19, 2001, at 05:39 PM, email@hidden wrote:

I am trying to get a file's size with NSFileManager using fileAttributesAtPath and NSFileSize (you know if you ever used it).

It returns the number of byte in the file, but it gives me the wrong number. I have a 8 KB text file, but when I divide the bytes by 1024, I get .10392 or something like that.

What am I missing here?

Is 8 KB really the size of the file, or is that just what is reported by the Finder?

Depending on how your disk is formatted, the file can be significantly smaller than 8 KB, but you can only have one file per block on your disk. If the file is smaller than your disk's minimum block size, the rest of the space on that block is lost.

So, if your disk has a minimum block size of 8 KB, and you have a text file with 1 character, the Finder will report that the file takes up 8 KB.

You can get the real size from the Finder by checking the Get Info panel.

Richard Schreyer


References: 
 >fileAttributesAtPath, NSFileSize problems (From: email@hidden)

  • Prev by Date: fileAttributesAtPath, NSFileSize problems
  • Next by Date: Re: WTF? How can this work?
  • Previous by thread: fileAttributesAtPath, NSFileSize problems
  • Next by thread: Thanks, Chris
  • Index(es):
    • Date
    • Thread