0

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.

Keith
  • 1
  • 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 04:47

2 Answers2

1

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.

silviud
  • 2,687
  • 2
  • 18
  • 19
1

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.

Phil Hollenback
  • 14,947
  • 4
  • 35
  • 52