PDA

View Full Version : Sync folder with FTP




cclloyd
Mar 13, 2013, 04:43 PM
Is there a way I can set up a folder to keep in sync with a FTP folder? Automatically uploaded any changed files the instant they change and any new files added or remove any files deleted. An exact copy of the folder on the FTP.



switon
Mar 13, 2013, 07:49 PM
Is there a way I can set up a folder to keep in sync with a FTP folder? Automatically uploaded any changed files the instant they change and any new files added or remove any files deleted. An exact copy of the folder on the FTP.

Hi cclloyd,

It depends a little bit on what you mean by "the instant they change". If you truly mean simultaneously, then you are talking about some type of mirroring, generally called RAID 1. If you configure two partitions and RAID 1 mirroring, then any change to a folder on one partition will instantly and simultaneously changed to the identical folder on the other partition.

If, however, by "the instant they change" has some slack built into it, say a minute or so, then you could use the "rsync" terminal commands to perform the copies for you. The nice thing about rsync is that it "knows" (through checksums) when a directory and its subdirectories have changed, what the changes are, and it makes a differential copy over the network retaining ownerships, permissions, and links. You could setup a cron job to run rsync every minute on your FTP folder.

So, as I mentioned, it depends upon what you mean by "instant". If you truly mean instant, then RAID 1. If there is some slack time allowed, then rsync.

...just some thoughts...

Regards,
Switon

cclloyd
Mar 13, 2013, 07:58 PM
Well I don't need full on RAID though, since it's only 1 directory with 1 remote directory on my server. But I do mean INSTANT.

switon
Mar 13, 2013, 10:28 PM
Well I don't need full on RAID though, since it's only 1 directory with 1 remote directory on my server. But I do mean INSTANT.

Hi,

Well, since you really do mean "instant" --- then almost by definition you mean RAID 1. Realize that you could setup two small partitions and do RAID 1 with them, thus when someone writes using FTP it is mirrored instantly to both partitions.

There are probably other instant mirroring tools available, but RAID is the most common one.

Regards,
Switon