header

Torsten Curdt’s weblog

Resource Forks

Ever wondered why tools like tar or rsync need support for so called “resource forks” on OSX? Resource forks are a way to store and attach extended attributes to a file. It’s sort of like they can have a parallel dimension. It can contain icons, positions or whatever you like.

So how can you access it? What I just recently came across is that there actually is a standard filename based way to access those forks. You just need to append “/..namedfork/rsrc” to the filename.

$ ls -aol test.xls
-rw-r--r--   1 tcurdt  tcurdt  - 113152 Nov 22 23:13 test.xls
$ ls -aol test.xls/..namedfork/rsrc
-rw-r--r--   1 tcurdt  tcurdt  - 0 Nov 22 23:13 test.xls/..namedfork/rsrc

As you can see, you see nothing. The file has no resource fork (as the size is 0). If you want to find files that have a resource fork you might want to try this query

find . -type f -exec test -s {}/..namedfork/rsrc \; -print

that I found here. Links that you dropped from your web browser onto the desktop are a good example. You will notice that these “.webloc” files have file size of zero. Still they get you to the desired URL when you click on them. If you open their resource fork with an editor you can see where this information has been stored.

(BTW: A similar facility is also available to windows user with NTFS …but less commonly used)

  • This is a legacy from the non unix version of Mac OS X. You used to have a nice tool called resedit to edit add and change resources. In that time most of the files and application would use the resource fork instead of the data fork in files.
blog comments powered by Disqus