Could anyone suggest some good ways of backing up a file from a Windows machine to a Linux platform using a batch file of powershell command?
My goal is to monitor a file for modification using a powershell script on startup, and then to back it up to the linux machine when modified.
Here is the lovely powershell script written by BigTeddy which I am in the proccess of modifying to execute a transfer script on the 'FileChanged' event:
The original can be found here
$folder = 'c:\Documents and Settings\Administrator\My Documents'
$filter = 'myFileToWatch.csv'
$fsw = New-Object IO.FileSystemWatcher $folder, $filter -Property @{IncludeSubdirectories = $false;NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}
Register-ObjectEvent $fsw Changed -SourceIdentifier FileChanged -Action {
<...CODE TO TRANSFER FILE...>
}
I have investigated several possibilities:
- rSync as part of Cygwin
- cwRsync
- robocopy
Unfortunatly I have had little success with Cygwin as an apparent bug has prevented the 'postinstall' from completing .. (but thats another story)
I have also run into problems with Windows refusing to recognize the installer for the Windows Server 2003 Resource Kit Tools which contains said Robocopy.
It has now decided to play ball.
cwRsync(free) does not support serving files.
I am very new to digging around in the depths of Windows so I imagine there are many possibilities of which I am unaware.