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

Click here to return to the '10.4: Use Spotlight as a quick and dirty database' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use Spotlight as a quick and dirty database
Authored by: lar3ry on Oct 18, '05 11:58:46AM
iF you have Apple's X11 installed, you might find the oft-overlooked utility "lndir" to be handy.

Simply create a directory, and then invoke this utility and point it to a directory tree, and it will create what it calls a "shadow directory tree" of the original directory in that the new directory will contain symbolic liks pointing at the real files.


$ mkdir ~/parts
$ lndir /Network/MySharedServer/PartsNumbers ~/parts

The above two lines will create a shadow directory called "parts" in your HOME directory that contains symlinks to all the files on the network share. If the original directory has subdirectories, the directory tree in the new directory will be constructed in the same format, with each file pointing to the appropriate file.

The nice part about this utility is that you can run this script regularly, say every hour or a midnight (depending on how often your network file structure is bound to change), and it will create new symlinks and directories as needed. Alternatively, your nightly/hourly script can remove the ~/parts subdirectory before it is run, ensuring that files deleted from the share are deleted in the shadow directory as well.

Despite one respondant's cry of "EEEW!" regarding your solution, it has good merit. Symlinks don't take up too much space, and it allows you to selectively determine WHAT you want Spotlight to index on your system. Personally, I wouldn't want Spotlight to index every item on my shared network folders... only those that I might have an interest in finding on my Tiger system.

I hope this helps!


[ Reply to This | # ]