PowerShell Sync local issue

Advertisement

BluHorse
Donor
Joined:
Posts:
2
Location:
Kentucky, US

PowerShell Sync local issue

I am having issue with the local sync using PowerShell not adhering to the the provided paths. I'm using version 5.17.10 build (11087) on Windows 10 Pro. It seems to be using the user directory of the current user and the root of the FTP connection regardless of what I pass. It moves files as it should, just the wrong files. I have also created a batch file to do the same thing and it works flawless but I need it as PowerShell so I can create and encoded command to use in another automation program for my SQL server.
PS C:\Users\bluhorse> & "E:\BluHorseJMS\Bluhorse-Data\Interfaces\FTP Service\WinSCP.com" `
  /log="E:\BluHorseJMS\Bluhorse-Data\Interfaces\FTP Service\WinSCP.log" /ini=nul `
  /command `
    "open ftp://???" `
    "synchronize local "E:\BluHorseJMS\Bluhorse-Data\Latest\Files\Silent\" "/SilentUpdates/ChesterTN/"" `
    "exit"
Connecting to xx.xx.xx.xx ...
Connected
Starting the session...
Session started.
Active session: [1] ???
Comparing...
Local 'C:\Users\bluhorse' <= Remote '/'
Synchronizing...
Local 'C:\Users\bluhorse' <= Remote '/'
Anderson, SC              |            0 B |    0.0 KB/s | binary |   0%

Description: powershell screenshot

TQBoDJh9hU.png

Description: log file

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: PowerShell Sync local issue

You have the quotes wrong. It should be:
    "synchronize local `"`"E:\BluHorseJMS\Bluhorse-Data\Latest\Files\Silent\`"`" `"`"/SilentUpdates/ChesterTN/`"`"" `
See https://winscp.net/eng/docs/commandline#syntax

Though you actually do not need the inner quotes at all, as there are no spaces in your paths:
    "synchronize local E:\BluHorseJMS\Bluhorse-Data\Latest\Files\Silent /SilentUpdates/ChesterTN" `

It's way better and easier to use WinSCP .NET assembly in PowerShell than WinSCP command-line:
https://winscp.net/eng/docs/library_powershell

Reply with quote

Advertisement

You can post new topics in this forum