Nuclear Rooster

6Aug/090

File size discrepency for empty files

I noticed a peculiar discrepancy between the size of an empty file in different operating systems. Not sure what is going on yet, but for some reason RHEL 4 boxes seem to think that an empty file is 4 kilobytes, where OS X and Ubuntu think it is 0 bytes. Hmmm.

Not sure why this is, but for me there was a pretty easy work around to checking for a 0 byte file; start reading the lines from the file and break after you read the first line to tell that the file is not empty.

OS X 10.5.7

nicks-computer-3:~ nick$ touch test.txt
nicks-computer-3:~ nick$ du test.txt
0	test.txt

Ubuntu 8.0.4

nick@ec2-99-999-99-999:~$ touch test.txt
nick@ec2-99-999-99-999:~$ du test.txt
0	test.txt

Red Hat Enterprise Linux ES release 4 (Nahant Update 6)

[nick@chloe ~]$ touch test.txt
[nick@chloe ~]$ du test.txt
4	test.txt
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.