Script SFTP
Hello,
I made a WinSCP script for SFTP. The script sends the files fine, but it freezes after that. It does not execute the rest of the script.
Would you have an idea?
Here is the script:
I made a WinSCP script for SFTP. The script sends the files fine, but it freezes after that. It does not execute the rest of the script.
Would you have an idea?
Here is the script:
# Local directory path LocalDirectory = "D:\RepSource\1\" # Archive directory path $Archivesdirectory = "D:\RepSource\Archives" & "C:\Program Files (x86)\WinSCP.com" ` /log="C:\Program Files (x86)\WinSCP\WinSCP.log" /ini=null ` /command ` "open sftp://serveursftp@sftpcom:22/ -hostkey=`"`"hostkey`"`"" ` "cd / ` "put $localdirectory* /" ` # Use the full path of the local directory "exit" # Add the exit command $winscpResult = $LastExitCode if ($winscpResult -eq 0) { Write-Host "Success" # Move files to archive directory after successful transfer Move-Item -Path "$repertoireLocal*.xml" -Destination $repertoireArchives -Force } else { Write-Host "Error" } exit $winscpResult