Transfer folder from one SFTP server to another every day -


i have 2 different servers. use winscp transfer folder manually:

  • i connect sftp on svr-01 -> transfer folder local machine

  • i connect sftp on svr-02 -> transfer folder local machine svr-02

what want?:

i automatically.

example: in command or script, svr-01 transfer folder /opt/home/files-everyday/ svr-02 /opt/backup/

when transfer finished, delete /opt/home/files-everyday/ svr-01.

this should done every day.

one folder created every day date "20150613" in svr-01 , folder automatically transferred svr-02.

you can use winscp scripting windows batch file:

@echo off  mkdir %temp%\intermediate  winscp.com /log=c:\path\log.log /command ^     "open sftp://user1:password1@server1.example.com/ -hostkey=""ssh-rsa 2048 87:d6...a7""" ^     "get /opt/home/files-everyday/* %temp%\intermediate\" ^     "open ftps://user2:password2@server2.example.com/" ^     "put %temp%\intermediate\* /opt/backup/" ^     "session 1" ^     "rm /opt/home/files-everyday/*" ^     "exit"  rmdir /q /s %temp%\intermediate 

then use windows scheduler run script regularly (every day).


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -