I am trying to write a automation for a SFTP Upload and need you help.
How can I realize to upload folders older than yesterday? I am scripting in PS with .NET Assembly. Here are my code snippet:
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.FileMask = "<1D"
$transferResult = $session.PutFiles($source, $destinationSFTP, $False, $transferOptions)
I do not get a Fault in the Debugwindow and the Script put all Files on the SFTP
Whats wrong with this?
In addition I want to put the uploaded Folders in a Subfolder with Overwriting if the Folder has been in the Subfolder. To realizing this I am trying to do this but still getting the Error-Message that the file cannot be created if it already exists.
Move-Item -Path $Sourcelocation -Destination $subfolder -Force -Recurse
Do you have a idea?
Thanks for your help!