-2

Windows/Azure

I'm looking for an application ( or other solution ) that would dynamically perform a bidirectional sync between an external SFTP site and local storage.

Specifically, ( thinking in a server-oriented manner ), there's an import folder and an export folder.

So if there's a server-side change to a file in the export folder ( including new/delete ), the client-side would reflect that ( within some interval ).

And in a similar manner, if there's a client-side change to a file in the import folder, the server-side would reflect that.

I suppose it might be necessary for this app to exist on both the client and server. Perhaps it's a special type of SFTP server.

The specific use-case is for timestamp-named files that are archived daily ( copied to an timestamp-named archive sub-folder, and then deleted from the primary folder ).

Especially interested in cloud solutions, such as for Azure.

I'm finding that many traditional DC SFTP servers still exist and the providers don't offer much flexibility ( e.g. they use a specific SFTP product and won't change ). So most optimal would be an app/solution that coexisted with an existing legacy SFTP server.

1 Answer 1

1

Ftp Voyager will do this. (Assuming windows, you did not say) https://thwack.solarwinds.com/resources/b/geek-speak/posts/ftp-voyager-debuts-as-solarwinds-free-tool

It will install as a service, and has a scheduler to make connection profiles to sites and then schedule them pull down data at times/intervals.

It is not hard to script SFTPs native client either, or even PSFTP (Part of the putty project), very similar syntax if you are familiar with ftp commands. https://www.puttygen.com/psftp

Specifically the switch -B, with with you can basically process a script of commands to do just like you were at the terminal, and then make that a task in the task scheduler

-B – It specifies a file with batch commands. The ‘-b’ command helps user automate tasks by allowing them to set commands in advance.

Syncing SFTP this way in either case does not require the server side to even be aware yo are automating it, much less install anything, It simply does the same thing a user would via code. https://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter6.html

Example using psftp: make a simple text file named dlall.txt

assuming there is an in queue folder named iQ, and a directory on the other side named out, the following script...

lcd - Change local directory to iQ

cd out - changes to out directory on remote side

mget * - multiple file get, downloads what is there.

quit - exits

lcd .\iQ
cd out
mget *
quit

and then pass it to PSFTP like so

psftp user@host -P [port number] -b dlall.txt

Now this assumes you know how to do authentication, both will accept credentials on the command line or you can set up pubkey authentication. I do not suggest password, because to automate it you have to store a password somewhere in plain text. FtpVoyager will store passwords but at least encrypt them. Both will work with pubkey much safer though.

Note as well you used the word "sync" if you want to make sure both sides are actually equal, this is harder, and woudl likely steeer you back to FTPVoyager

https://support.solarwinds.com/SuccessCenter/s/article/How-Can-FTP-Voyager-Automatically-Synchronize-Folders-on-2-Different-Sites?language=en_US

OR possibly look into rsync over ssh if the server will support that.

2
  • Thanks for the response. Does the SFTP/PSFTP scripting only support a get all ? Or is it possible to only pull-down changed files ( including new/delete ) ? This would be key if job is run on a tight interval, say 300 secs.
    – BaltoStar
    Sep 6 at 4:24
  • No way to do that native, you can however script commands like ls -lah to get things like file attributes, and make decisions on your side, which is essentially what things like ftp voyager do. But that implies on your side, logic, just a fire and forget script cannot do that, you would need a language that can process logic like powershell, bash, etc, and get the return of one sftp interaction (file list), to stage a second "retrieve", that's why I put that "if you really meant sync" at the bottom, people have done that code for you, unless you are really just a homebrew type of person :-) Sep 6 at 20:39

Not the answer you're looking for? Browse other questions tagged .