Maintenance

  • Home
  • Log in
  • « Ultimate Windows Install Disk
  • New build in Lab B. Lab C to follow ATP »

Backup script for Windows

Posted by gregster on 08 Nov 2007 in R & D, Activity log

Built a simple backup script that can be run on Windows machines against remote machine via SCP.

1) Install WinSCP from http://winscp.net/. Make sure that the console interface tool is installed, and the install directory is part of your PATH. If the installer doesn't ask you about this, do it post-install from the advanced preferences panel.

2) log in to the remote machine and store the connection settings as <sessionname>

3) Write a little script like this:

option batch on
option synchdelete on
option exclude "*.dat"
synchronize remote "c:\path\to\source\directory" "/path/to/remote/directory/" 
exit

and name it <scriptname>.txt

4) To invoke the script do this:
>winscp.com <sessionname> /script=<scriptname>.txt

Online docs are bad. For actual invocation run help on the installed version.
I wrote the above based on the documentation when I ran winscp.com /? and got this:

WinSCP, Version 4.0.5 (Build 354)
Copyright (c) 2000-2007 Martin Prikryl

Usage:
WinSCP session
WinSCP [(scp|sftp)://][user[:password]@]host[:port][/path/[file]]
WinSCP [session] [/console] [/script=file] [/command command1 command2 ...]
WinSCP [session] /synchronize [local_dir] [remote_dir] [/defaults]
WinSCP [session] /keepuptodate [local_dir] [remote_dir] [/defaults]
WinSCP /ini=<inifile> /log=<logfile> /privatekey=<keyfile>
WinSCP /update
WinSCP /help

 session  - Name of stored session or session information specified directly.
 /console - Console (text) mode. Default mode, when invoked using WinSCP.com.
 /script  - Executes batch script file. If the script does not end with 'exit'
            command, normal interactive mode follows.
 /command - Execute list of script commands.
 /synchronize  - Synchronizes content of two directories.
 /keepuptodate - Starts Keep remote directory up to date function.
 /defaults     - Starts operation without showing options dialog.
 /ini     - Path to configuration INI-file.
 /log     - Turns on logging to file.
 /privatekey - Default private key file for authentication.
 /update  - Queries application homepage for updates.
 /help    - Prints this usage.

Of note is the version number. The commands available are quite different from those online.

This entry was posted by Greg and filed under R & D, Activity log.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2026 by admin • Help • b2evolution