I have a problem with Cygwine's rsync. With a Powershell script I am trying to transfer directories from a Novell server to a Windows server
The path for the source is a variable that comes from a CSV file
Function CopyRsync ([string]$source,[string]$dest){
$sourceRoot = "root@"+$source +"/"
$dest = "/cygdrive/g/Shares/" +$dest
cmd.exe /C "e:\cwRsync\bin\rsync.exe" -vrts --progress --whole-file --no-compress --no-checksum -e "/cygdrive/e/CWrsync/bin/ssh" $sourceRoot $dest --delete-before
}
$novel = 'server.domaine.local:/media/nss/rep01/Com/Com dir Soins info'
$dfs = "C:\temp\Rsync"
CopyRsync -source $novel -dest $dfs
If the source path in the variable does not contain a white space the script runs correctly, but if the path contains a white space the content of the variable will be parsed with quotes and the script stop running because the SSH session recieve "root@... as user with quotes in the begining of user root like this
"E:\cwRsync\bin\rsync.exe" -vrts --progress --whole-file --no-compress --no-checksum -e /cygdrive/e/CWrsync/bin/ssh "[email protected]:/media/nss/rep01/Com/Com dir Soins info/" /cygdrive/g/Shares/C:\temp\Rsync --delete-before
How can I parse a variable to ignore the quote from script variable?