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

I'm looking for a way to copy photos that are uploaded to one folder to many other folders and visa versa.

Example: a photo is uploaded to folder 1, it is then copied to folders 2-5. And if a photo is uploaded to folder 2 it is copied to folders 1 and 3-5.

I'm running CentOS 5. All of these folders are on the same server.

I came across another post on here that talked about incron, but that type of programming is over my head.

share|improve this question
    
incron is not programming. It's just installing a daemon, creating a slightly-opaque-but-not-awful-at-least-it's-documented incrontab config file, and maybe a simple shell script to do the work. –  mattdm Jan 13 '11 at 4:47

2 Answers 2

rsync will do the job.

you need to setup a cron job from a shell script that what it does is running rsync over all your directories.

share|improve this answer

Instead of rsync, check out unison - it handles synchronizing two directories better than rsync.

I can envision doing this with a bash script running a series of unison commands to keep all the directories in sync:

for i in 2 3 4
do
  unison /dir1 /dir$i
done

put that in a crontab that runs every hour or whatever ( I realize my unison syntax is not right).

However, I do really like the incrond approach. That would give you a cleaner design because it would allow you to only run the synchronizer when one of the directories change. However indeed it's more work to set up.

share|improve this answer

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.