• 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: Where are my bytes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where are my bytes?


  • Subject: Re: Where are my bytes?
  • From: Uli Kusterer <email@hidden>
  • Date: Sat, 04 Apr 2015 16:39:07 +0200

IIRC file compression saves the compressed file data in a file’s resource fork. Your stat call probably only sees the data fork.

Other sources for seemingly incongruent numerics could be:

-> Finder displays hard disk bytes in SI-style units (i.e. 1000 bytes == 1 kilobyte) like hard disk manufacturers have been doing it for ages, not 1024 like programmers and RAM manufacturers do it.

-> files have overhead (storing metadata, file names, allocation blocks) so depending on which API you use, some or all of these may be included or not

-> As implied above, files on HFS+ have a resource fork that can also take up space on disk, and API may or may not include this in its reports.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


On 04 Apr 2015, at 11:23, Gerriet M. Denkmann <email@hidden> wrote:
> When I look at " /Library/Dictionaries/Apple Dictionary.dictionary/Contents/Info.plist" in Finder, it shows a preview and says 5 kB. Ok.
>
> But: Finder → FIle → Get Info says:
> 4,893 bytes (Zero bytes on disk)
>
> And lstat shows:
> st_size	= 4893	(file size, in bytes)
> st_blocks	= 0		(blocks allocated for file)
> st_flags	= 0x20 	(user defined flags for file)
>
> /usr/include/sys/stat.h has:
> #define UF_COMPRESSED	0x00000020	/* file is hfs-compressed */
>
> So: where are these bytes (if not on disk)?
> And if they are really compressed: how much space they take in some unknown compressed location?
>
> I am trying to find who or what is taking space on my disk. So given some directory, I want to add the disk space of all its files (+ subdirectories).
>
> OS X 10.10.2
>
> Gerriet.
>
>
> _______________________________________________
>
> 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:


_______________________________________________

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: 
 >Where are my bytes? (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Where are my bytes?
  • Next by Date: Re: Where are my bytes?
  • Previous by thread: Re: Where are my bytes?
  • Next by thread: Re: Swift: How to determine if a Character represents whitespace?
  • Index(es):
    • Date
    • Thread