File size in Finder vs. Terminal: a follow-up
File size in Finder vs. Terminal: a follow-up
Regarding yesterday's item noting that the "ls -l" ls command in Terminal reports a size of 0K for a file that only has a resource fork: Several readers confirmed this, but offered< various solutions:
Use /rsrc Brian Duart reports that typing 'ls -l filename/rsrc' should show the correct size of a file that only has a resource fork. We tried it on the System file mentioned yesterday; it worked. It displayed "256031" instead of "0".
Use du Jeffrey Mattox and Seth Noble both suggested using the du command rather than the ls command to see "the number of 512-byte blocks allocated for the file; the result is non-zero for files that appear empty to ls. Again, this worked, yielding "504" for the System file.
Seth adds: "du reports the number of 512-byte blocks by default. To get it to report kilobytes, set the environment< variable BLOCKSIZE to 1024 setenv BLOCKSIZE 1024. This is best done in your shell resource script (.cshrc, .tcshrc, etc.)."
Or, as pointed out by Sean Peisert, you can use "du -k" to get the number of 1024-byte blocks.