FTP Sync

What is FTP Sync?

FTP Sync allows synchronizing files on multiple client machines via an FTP server. U wrote this because my web host does not run CVS. Additionally, I usually sync large binary files, and I need only the latest version. FTP Sync saves file information (version and timestamp) in an XML file which is stored on the FTP server alognside the file with content. The program compares the version number in the remote XML file, and the time stamp on the local XML file, figuring out whether to upload the local version or download the remote one.


Look for comments in ftp_sync.rb, and see sync_citydesk.rb.



And example configuration files:



For instance, let's say that all your project files are in a directory on your local machine, and also kept on a directory on your FTP server:

    local:      C:\Projects\
    remote:     ftp://ftp.server.com/john/projects

Add these two locations into the config.ini, along with the server authentication info. Now invoke the script and pass your file as an argument

    ftp_sync.rb   C:\Projects\super_widget\src\sw.txt
The string "super_widget/src/sw.txt" will be looked up in the control.xml, and in "control.xml" stored on the server. Depending on the version number, the file 'sw.txt' will be uploaded or downloaded.


    ftp_sync.rb   C:\root_dir\sub_dir\another_sub_dur\file.bin

Look into file sync_citydesk.rb. This is an example usage of FTP Sync. Given a file, it will

  1. Synchronize the file before editing
  2. Run the default editor for the file
  3. Synchronize the file again after editing is done.