What’s up with Snow Leopard and file sizes?

Yes, I know Snow Leopard changed the way they calculate file and volume sizes, but what I’m seeing here is too weird to be explained by that. I’ve got a few image files in a folder on my desktop and the filesizes I’m seeing with ls -al is:


Now watch the png file sizes when I look at it using Finder:


Oops… WTF was that??! A display bug! Let’s try again after juggling the column widths so the selection bar straightens itself out again:


Just to be sure, I opened up the info panel on the first file:


Yes, truly, here it says 109,207 bytes while ls -al says 15,843 bytes for the same file. And yes, I’ve checked and double checked and triple checked, I do indeed look at the same file. Doing a spotlight search also only returns one image. Uploading the image to a webserver and checking through Transmit shows the 15k size. Here it is, the file, from a webserver: http://vard-it.com/images/20091019/interaktioner1.png, so you can check for yourself.

So why is Finder reporting a size value seven times larger?

Update a little later: yes, I used the ls -al@ to find the resource fork and that is what is making the difference. Maybe Finder should have the option of showing that separately at least in the inspector? Maybe I should read the man pages before posting? Maybe I should wonder what exactly are in those resources? Maybe I should just shut up and crawl under a rock?

Yet another update: I used 0xED to look into the file and the fork. The fork is full of Adobe info, since I used Photoshop CS4 to convert from a BMP to PNG. And, obviously, when uploading the image using Transmit, that fork is stripped off. Well, now I know that Photoshop saves a load of info in a resource fork, possibly including  info I don’t want them to save. Can’t see any obvious way of excluding that in the Photoshop save dialog box. So take care when passing on images to others that you strip off the resource fork first. Somehow.

Update about “Somehow”, this is how to do it: create an empty file, copy it over the resource fork, then delete the empty file. Like so, in terminal:


1 thought on “What’s up with Snow Leopard and file sizes?”

  1. This has been a while but I’ve recently discovered your site. You can also remove the resource fork for any file with the following command:

    xattr -d com.apple.ResourceFork filename

    xattr does not have a man page, use xattr –help for more info.

Comments are closed.