Crear el archivo ‘pull_changes.txt’ :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#Pull changes from the remote folder to the local folder #http://winscp.net/eng/docs/scriptcommand_synchronize #open a connection to the server specifying the name of the server #open scp://server.home.com:3687 -privatekey=C:\location\to\private\key.ppk #open a connection to the server using a saved winscp session open troy@server.home.com -privatekey=C:\location\to\private\key.ppk #local folder: C:\Users\troy.williams\Documents\home sync #remote folder: /home/troy/home sync # Synchronize my folders, pulling changes from the remote to the local synchronize local "C:\Users\troy.williams\Documents\home sync" "/home/troy/home sync" #close the session close #exit the scripting environment exit |
Para enviar archivos crear ‘push_changes.txt’:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#push changes from the local folder to the remote folder #http://winscp.net/eng/docs/scriptcommand_synchronize #open a connection to the server specifying the name of the server #open scp://server.home.com:10000 -privatekey=C:\location\to\private\key.ppk #open a connection to the server using a saved session open troy@server.home.com -privatekey=C:\location\to\private\key.ppk #local folder: C:\Users\troy.williams\Documents\home sync #remote folder: /home/troy/home sync # Synchronize my folders, pushing changes from the local to the remote synchronize remote "C:\Users\troy.williams\Documents\home sync" "/home/troy/home sync" #close the session close #exit the scripting environment exit |
Ejemplo de archivo bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
@rem -------------------------------- @rem created 2011-08-08 copyright (c) 2011 Troy Williams @rem This file will pull changes from my server at home @ECHO OFF SET WINSCPHOME=C:\Program Files (x86)\WinSCP SET CWOLDPATH=%PATH% SET PATH=%WINSCPHOME%;%PATH% echo Pulling changes from the server winscp.com /script=pull_changes.txt pause |