Topic "Can't get attributes of file"

Author Message
EricC

Guest


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.
Code:
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!

Code:
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
}
WinSCP.log (6.24 KB) [Download]

Description: (none)

Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26572
Location: Prague, Czechia
Please attach a log file from GUI showing a successful download of the same file.
EricC

Guest


martin wrote:
Please attach a log file from GUI showing a successful download of the same file.


Sorry for my mistake.
I can do a GUI transfert but with FileZilla.

The file i try to download is hidden, the i need the "Manual Transfer" commande to do it (I don't know if WinSCP have a similar command).

I attach a FileZilla log file from GUI showing a connection to the server and a successful download of the file.

Thanks.
filezilla170105.log (5.44 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26572
Location: Prague, Czechia
WinSCP needs to be able to retrieve attributes of a file to download it. At least to know if that "name" is a file or a folder.
Advertisements

You can post new topics in this forum






Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License