Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Can't get attributes of file

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.
EricC

Re: Can't get attributes of file

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.
martin

Re: Can't get attributes of file

Please attach a log file from GUI showing a successful download of the same file.
EricC

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.
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
}