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.

link|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
feedback

2 Answers

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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