Can't get attributes of file
Hello,
I have write a lot of PowerShell script to download file from our customers FTP serveur.
Today one of these script dosen't work.
I can dowload the file with the GUI, but my script dosen't work.
I have made an update of WinSCPnet.dell to 5.9.3.
I have try to "GET" all "*.zip" and some other stuff...
I add below a part of my code, and i join a log to this message.
Someone have an idea?
Thanks!
I have write a lot of PowerShell script to download file from our customers FTP serveur.
Today one of these script dosen't work.
I can dowload the file with the GUI, but my script dosen't work.
Error: Can't get attributes of file '/incoming/Metasys/metasys.zip'. File or folder '/incoming/Metasys/metasys.zip' does not exist.
I have made an update of WinSCPnet.dell to 5.9.3.
I have try to "GET" all "*.zip" and some other stuff...
I add below a part of my code, and i join a log to this message.
Someone have an idea?
Thanks!
try
{
# Load WinSCP .NET assembly
Add-Type -Path $WinSCPdllPath
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::FTP
FtpMode = [WinSCP.FtpMode]::Passive
HostName = $HostName
UserName = $UserName
Password = $Password
}
$session = New-Object WinSCP.Session
$session.SessionLogPath = "c:\Temp\WinSCP.log"
try
{
# Connect
$session.Open($sessionOptions)
# Upload files
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary
$transferOptions.PreserveTimeStamp = $True
$transferResult = $session.GetFiles($($FTPPath + "metasys.zip"),$LocalPath, $False, $transferOptions)
# Throw on any error
$transferResult.Check()
}
finally
{
# Disconnect, clean up
$session.Dispose()
}
exit 0
}
catch [Exception]
{
Write-Host ("Error: {0}" -f $_.Exception.Message)
exit 1
}