2

I create a file based on time or something like that for stylesheet. It is fingerprinting filename to avoiding cached version on web browser. Example file name: style_1374065326.css.

I want to create a symlink for any newly created file in another folder. Is it possible?

If not, is it possible to create a folder CSS/ in another folder where I want to create symlinks and that folder have symlinks for all the similar file names in another directory where files can come dynamically.?

1 Answer 1

1

to symlink all CSS-files in a given directory into another simply do:

$ cd /path/to/symlinkdir
$ ln -s /path/to/orgdir/*.css .

if a file is already symlinked (or otherwise existing), you will get a warning like ln: failed to create symbolic link '/path/to/orgdir/style_1374065326.css': File exists which you can safely ignore.

if you want this to be fully automated, you might want to check inotify to monitor the source directory and run the symlink command whenever a .css is created therein.

4
  • I do not know if this is the only way, but possibly the answer is the only way. The C prog after so long is looking tough task. Oct 1, 2013 at 16:44
  • @SatyaPrakash the answer is very simple, if what you want to do is to have each file in one directory symlinked to another directory. if this is not exactly what you want, please specify
    – umläute
    Oct 2, 2013 at 8:50
  • No, want symlink for files created dynamically. It can also work that all files of certain type involved. Oct 4, 2013 at 16:48
  • @SatyaPrakash my method is not concerned how the original files are created, meaning it will work with files that were created dynamically. what is missing?
    – umläute
    Oct 6, 2013 at 18:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .