As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread:

one-way synchronization --SOLVED look inside for step-by-step instructions

RamiusRamius Joined: July 19, 2000Administrator, ClubPA admin
edited September 2008 in Help / Advice Forum
I've searched google unsuccessfully, so perhaps someone could help me out.

I'm looking for a FREE utility that will run on Windows XP, preferably running all the time in the system tray, which I can configure to watch a certain directory and any time a new file or files are added, it will either:
  1. Send those files over an SSH connection to a directory on my webserver, OR
  2. launch some batch file or other program with each file that it found (then I can setup the intermediary program that does the uploading to the webserver)

Any recommendations?

Ramius on


  • PirateJonPirateJon Registered User regular
    edited September 2008
    I never found one, so ended up using a vbscript. it would check the dir, transfer any found files via FTP, log it, then sleep for 10 seconds and check again.

    but that's before I found out about the FileSystemWatcher class. Link with sample script.

    PirateJon on
    all perfectionists are mediocre in their own eyes
  • RamiusRamius Joined: July 19, 2000 Administrator, ClubPA admin
    edited September 2008
    Blech, yeah I'm familiar with the FileSystemWatcher stuff, so I know this should be relatively easy to program, which is why I expect someone else to have already done the work for me.

    So thanks for the idea, but I'd rather just download+install something if it exists (which it should, in any sensible world).

    Ramius on
  • PirateJonPirateJon Registered User regular
    edited September 2008
    Oh it exists, but they all seem to be filthy capitalists demanding blood money. I blame lack of universal health care.

    Luckily since I'm unemployed and waiting on pizza, I did have the time to dig this up:
    Directory Monitor
    Download (version

    * Monitor directories for file changes, modifications, deletions and new files.
    * Monitor local directories or network shares (including hidden shares).
    * Optionally execute an application when an event occurs.
    * Quickly tell if a directory is available and being monitored.
    * Balloon notifications whenever an event is fired.
    * Auto updating, import/export and more.
    * FREE!

    Disclaimer - I have never used this or heard of this guy before.

    PirateJon on
    all perfectionists are mediocre in their own eyes
  • BarrakkethBarrakketh Registered User regular
    edited September 2008
    The program that PirateJon linked doesn't seem to support transferring the files, but you could you rsync to handle the transfer over SSH. There is an unofficial package for Windows that doesn't require a normal Cygwin installation, but I haven't used it myself since there are official Linux builds of rsync :P

    Barrakketh on
    Rollers are red, chargers are blue....omae wa mou shindeiru
  • RamiusRamius Joined: July 19, 2000 Administrator, ClubPA admin
    edited September 2008
    yeah, I had a strong feeling rsync could do it, but I knew there would be a learning curve and I wanted to avoid it if possible.

    In the end, I got it working like this:

    1) download the cwRsync installer from here (homepage)

    2) install to c:\util\cwRsync

    3) download AutoIt3 from here

    4) install to c:\util\AutoIt3

    5) Open a command prompt, situate yourself in the c:\util\CwRsync\bin directory, and then loosely follow these directions.
    - Note that cwrsync comes with both the ssh and ssh-keygen utilities that are needed
    - Note that if you have some other 'ssh' in your path, you should use the absolute path to the cwrsync, like so: rsync -avz -e "c:\util\cwrsync\bin\ssh" /this/dir/ remoteuser@remotehost:/remote/dir
    - Note that the from and to will be switched around from the examples
    - Note that local paths need to use cygwin style, like /cygdrive/d/somefolder/ or /util/cwrsync/doc/

    6) When the directions in step 5 have gotten you to the point where the following command works: rsync -az -e "c:\Util\cwRsync\bin\ssh -i my-rsync-key" /my/local/path/
    Then, save that command to a batch file (e.g. c:\util\cwrsync\bin\sync.bat), like so:
    @echo off
    echo .
    echo .
    echo .
    echo         Found new pictures to synchronize with
    echo .
    echo .
    echo                       SYNCHRONIZING...
    c:\Util\cwRSync\bin\rsync -az -e "c:\Util\cwRsync\bin\ssh -i my-rsync-key" /my/local/path/
    echo .
    echo   Done.

    7) Create an AutoIt script, like so:
    While 1
      $lastSizeBytes = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\mysync", "sizeBytes")
      $lastSizeFiles = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\mysync", "sizeFiles")
      $size = DirGetSize("C:\my\local\path",1)
      $sizeBytes = $size[0]
      $sizeFiles = $size[1]
      If (($sizeBytes <> $lastSizeBytes) OR ($sizeFiles <> $lastSizeFiles)) Then
        ; for testing   Msgbox(0,"DirGetSize-Info","Size(Bytes):" & $size[0] & @LF & "Files:" & $size[1] )
        Run(@ComSpec & " /c " & "c:\Util\cwRsync\bin\sync.bat","c:\Util\cwRsync\bin\")
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\mysync", "sizeBytes", "REG_SZ", $sizeBytes)
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\mysync", "sizeFiles", "REG_SZ", $sizeFiles)
      Sleep(300000)  ; sleep for 5 minutes

    8) Add the AutoIt script to your startup items, and now you have a tray icon watching the folder every 5 minutes for any change in the number of files or bytes, which will launch rsync over ssh if it finds any changes.

    Ramius on
  • RamiusRamius Joined: July 19, 2000 Administrator, ClubPA admin
    edited September 2008
    if anyone is interested, I actually tweaked the rsync params a bit to get something more suitable for my purposes:
    c:\Util\cwRSync\bin\rsync -rtz --chmod=Du+rwx,Dgo+rx,Fu+rw,Fgo+r --delete -e "c:\Util\cwRsync\bin\ssh -i my-rsync-key" /my/local/path/

    Ramius on
  • TheDragonTheDragon Registered User regular
    edited September 2008
    Sounds like you got it solved, but a simple solution to keep folders on different computers in sync:

    Windows Live FolderShare

    TheDragon on
This discussion has been closed.