I'm wondering if anyone knows of a nice way to partially duplicate (hard link) files between two directory structures?
My current fall back is a script invoked by cron.
As background:
I ask since I have two groups who both need to access a body of files in a directory structure served via HTTP using Tomcat. A privileged group may access all the files and a less privileged group may only access a "public" subset. These sets are not aligned to particular directories but the different class of file can be identified by their naming convention (but not extension).
Therefore my current idea is to serve two separate directories, one containing only private (possibly password protected) and the other containing public. Then to run some periodic process whereby I create hardlinks from the public files so they appear in the private directories for the convienence of the privileged users. I choose to link in that direction since it's more important that the file is available immediately for the unprivileged users. (priv = admin, unpriv = regular user)
I hope that makes sense. I'll try to clarify if anyone has any questions.
I would use symbolic links.
You could use this Bash script:
with something like these two commands:
Something like what Dennis proposed would work in a cron job or similar.
If this were linux, I would point you at inotify which would allow you to eliminate the cron job and latency from hardlinks reflecting the original directory.
This doesn't appear to exist under Solaris, however.
If the hardlinks are not too critical, a cron job will probably do just fine.