Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 2 folders on my Linux OS, Apache 2 Webserver. Call them folderA and folderB . They are have following paths

site1/public/sites/all/folderA

site2/public/sites/all/folderB

I would like that whenever a file is added/edited to folderA, a symlink is created/modified in folderB

Is there a way I can do it?

Any help would be appreciated.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

folderB can be a symlink to folderA.

share|improve this answer
    
I had one query. If I make folderB symlink to folderA and later add files to folderA, will newly added files to folderA after the symlink has been created be accessible via folderB too? –  Loveleen Kaur Sep 15 '10 at 8:18
    
I checked, they will be..thanks anyways for the help! –  Loveleen Kaur Sep 16 '10 at 4:02
add comment

I would suggest incron or inotifytools. They will watch for file creation or other activity and take an action that you designate.

share|improve this answer
    
Agreed. With incron, make a rule that will look like site1/public/sites/all/folderA IN_CREATE,IN_CLOSE_WRITE /path/to/your/script $@ where $@ will contain the path to the created/modified file. Have a look at man 5 incrontab for more info. –  ℝaphink Sep 14 '10 at 14:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.