Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create self-updating symbolic links UNIX
You can create symbolic links that update themselves when the target moves, just like aliases, but this only works with HFS+ volumes. This is done by targeting the symlink into /.vol/. The only problem is that if the target is deleted and then replaced (instead of just truncated), the symlink will stop working. To start, you need to know the /.vol/ path to symlink to, and you use the Terminal and the Finder for that. In the Terminal, type:
sudo fs_usage | grep 'getattrlist[^@]*Finder'
and then select the item you want to symlink to in Finder. Don't actually open the selected item, because the Finder will start to access stuff inside it (if it's a folder). When you select the item in the Finder, the Terminal window should now display at least one line like this (extra spacing deleted to save width):
15:45:08  getattrlist   /.vol/234881031/3053977   0.000051   Finder
The last one is your target, so you can create the symlink by typing:
ln -s /.vol/234881031/3053977 myalias
This link will stay the same even if you move or rename the target.

[robg adds: In my testing, I couldn't seem to figure out which of the several getattrlist items to select -- if I clicked a folder, for instance, I'd get about 20 lines of output, some of which were dupes, but others weren't. If anyone can clarify this method, I think it could be very useful.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[3,801 views]  

Create self-updating symbolic links | 2 comments | Create New Account
Click here to return to the 'Create self-updating symbolic links' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create self-updating symbolic links
Authored by: cynikal on Nov 10, '03 01:22:15PM

The reason you see multiple ones, is becuase by switching programs you end up getattr's of multiple items, like the parent folder of the folder you're selecting, and possibly other things like the desktop database (.DS_Store) of the parent folder as well.

You just need to isolate the one file you're interested in, by click on something else (like the background of the finder), then re-clicking the folder you're interested in. it should print less getattr's, maybe the same one duplicated twice (in my experience) but it should boil down to one particular.

Does anyone have more information about this, besides the man page? I notice in some of the property list config files (.plist's), there's a long alias strong that references a file/directory probably in a similar way (ableit it's encoded in a very long format). Is there a way to decode this to indicate which file/dir it's referencing, and also a way to re-encode a different file/folder reference?



[ Reply to This | # ]
Create self-updating symbolic links
Authored by: duelafn on Nov 10, '03 01:50:11PM
The second number is the inode number. you can get this number by using ls:
ls -i filename
or for directories
ls -di directory


[ Reply to This | # ]