Work with resource forks in the Terminal

Feb 24, '02 09:53:20AM

Contributed by: robg

While visiting a friend the other night, he showed me a trick in the terminal that I hadn't seen before, and I'm pretty sure hasn't been mentioned here as of yet. I'm also not sure of the usefulness of this trick, but it is interesting.

You can work with the resource fork for any file by simply adding "/rsrc" to the end of some file handling commands. For example, you could use this method to see which files within a directory contain resource forks:

% ls -al */rsrc
-rw-r--r-- 1 robg staff 0 Apr 25 2001 top.term/rsrc
-rwx---rwx 1 robg staff 0 Nov 21 22:33 travel.pdf/rsrc
You can also use this flag on "cat" and "cp" commands, allowing you to display (not very useful) or copy the resource fork of a given file.

I'm not sure how long this has been there, nor if the Developer Tools are required or not, but perhaps someone can find a good use for this modifier.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2002022409532098