lunedì 17 settembre 2007

Resource Fork, how to get rid of it

***** WARNING *****

Use the informations of this post at your own risk
You can loose data if you don't know what you are doing

How do you know if one file has associated resource fork with it.

It's fairly simple.
Open up the Terminal application. Change the directory to the one the file is located and type this command

ls -la filename/rsrc

If the file "filename" has resource you'll see an output like this one

-rw-r--r-- 1 yourusername yourusername 57847 Jan 1 2004 filename/rsrc

In this case the resource fork size is 57847 bytes long.

If the file has no resource fork at all, the file size should be 0 (zero).

What about get rid of this resource information

Create an empty file

touch emptyf

and copy it over the resource

cp emptyf filename/rsrc

Check the result issuing the ls command again

ls -la filename/rsrc

This time the output should look like this

-rw-r--r-- 1 yourusername yourusername 0 Sep 17 10:48 filename/rsrc

To know more about the macintosh file system read these articles