User Tools

Site Tools


rsync_reference

Rsync Reference

The windows implementation of rsync is called cwrsync.

Example batch file

@ECHO OFF

REM Make environment variable changes local to this batch file
SETLOCAL

REM ** CUSTOMIZE ** Specify where to find rsync and related files (C:\CWRSYNC)
SET CWRSYNCHOME=C:\Program Files (x86)\cwRsync

REM Set CYGWIN variable to 'nontsec'. That makes sure that permissions on your windows machine are not updated as a side effect of cygwin operations.
SET CYGWIN=nontsec

REM Set HOME variable to your windows home directory. That makes sure that ssh command creates known_hosts in a directory you have access.
SET HOME=%HOMEDRIVE%%HOMEPATH%

REM Make cwRsync home as a part of system PATH to find required DLLs
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\BIN;%PATH%

REM Windows paths may contain a colon (:) as a part of drive designation and backslashes (example c:\, g:\). However, in rsync syntax, a colon in a 
REM path means searching for a remote host. Solution: use absolute path 'a la unix', replace backslashes (\) with slashes (/) and put -/cygdrive/- 
REM in front of the drive letter:
REM 
REM Example : C:\WORK\* --> /cygdrive/c/work/*
REM 
REM Example 1 - rsync recursively to a unix server with an openssh server :
REM
REM       rsync -r /cygdrive/c/work/ remotehost:/home/user/work/
REM
REM Example 2 - Local rsync recursively 
REM
REM       rsync -r /cygdrive/c/work/ /cygdrive/d/work/doc/
REM
REM Example 3 - rsync to an rsync server recursively :
REM    (Double colons?? YES!!)
REM
REM       rsync -r /cygdrive/c/doc/ remotehost::module/doc
REM
REM Rsync is a very powerful tool. Please look at documentation for other options. 
REM

REM ** CUSTOMIZE ** Enter your rsync command(s) here
rsync -r -u --delete -v "/cygdrive/C/External Drives/Secondary Media/Mp3s" "/cygdrive/E"

Useful Options

-r Recursive
-u Update files that need updating (rather than just copying everything)
--delete Delete files in the destination that are not in the source.
-v Verbose. More info, but not too much info.
-n Test run. Don't actually do anything.

How To Sync Work Media to Secondary Media

  • Take Work Media hard drive home.
  • Plug into Zeus.
  • Mount C:\External Drives\Work Media\Content.tc to M Drive. Mount as read-only!
  • Run the batch script M:\Sync Mp3s - Work Media to Secondary Media.bat.
rsync_reference.txt · Last modified: 2016/12/31 19:05 (external edit)