0

I have Two FTP accounts on different servers: FTP A and FTP B.

FTP A has one folder named ftp_a and FTP B has another folder ftp_b. Now I want to sync these folder automatically and periodically.

How can it be done?

ftp_a will be master folder.

Whichever new files comes inside ftp_a must be transferred to ftp_b folder.

MasterAM
  • 16,283
  • 6
  • 45
  • 66

2 Answers2

0

You don't want to use FTP.

FTP is for manual operations, it can be scripted, but for what you want it is a PITA.

rsync can be set up to ensure that two folder are kept in line with each other, changes made to one are copied to the other, and you can control if this is one way or bi-directional, if you should remove files etc. You would need to set up a chron job to keep doing the rsync. There is also a nice system called sshfs that lets you mount a remote folder over ssh and use it as if it was a local folder.

thecoshman
  • 8,394
  • 8
  • 55
  • 77
0

Do you mean using custom programming, or can you use an external tool? If you can use an external tool, you could use something like SyncBack.

Custom Programming: I'm assuming you don't have access to either FTP server? If you do have access, then that makes it easier. You can use .NET's FileSystemWatcher control to find changes in real-time. Or perhaps Python's WatchDog (harder to use).

Otherwise, you'll need to regularly scan the master folder. Every language has FTP libraries. Here's a relevant answer in Python: Python-FTP download all files in directory

Community
  • 1
  • 1
SilentSteel
  • 2,344
  • 1
  • 28
  • 28