Topic ""Can't get attributes of file" on RemoveFiles in PowerShelll"

Author Message
[View user's profile]

Joined: 2013-09-04
Posts: 1
I see a Can't get attributes of File" error invoking REmoveFiles from a Powershell script. PutFiles and ListDirectory in same script work fine. Wildcards "*" instead of specific filename also works fine. Help apreciated.

    WinScp : 5.1.7
    WingFTP Server (Lastest / Debian Linux)
    Win2k8R & Win7_32

$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Ftp
$sessionOptions.HostName = "Server"
$sessionOptions.UserName = "user"
$sessionOptions.Password = "pass"
$session = New-Object WinSCP.Session
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Binary

$Result = $Session.RemoveFiles("/path/file.pdf")

>> Exception calling "Check" with "0" argument(s): "Can't get attributes of file '/path/file.pdf'"

The log of the server hints a problem:

MLST /path/file.pdf
502 Command not implemented

So how to disable that?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
Please read documentation about Use MLSD command for directory listing:

If that does not help, come back.
Martin Prikryl

You can post new topics in this forum

Search Site

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License