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

Author Message
juppy
[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


Code:
$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
$session.Open($sessionOptions)

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

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




The log of the server hints a problem:
Code:

MLST /path/file.pdf
502 Command not implemented
.

So how to disable that?
[/code]
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please read documentation about Use MLSD command for directory listing:
https://winscp.net/eng/docs/ui_login_ftp
https://winscp.net/eng/docs/rawsettings

If that does not help, come back.
_________________
Martin Prikryl
Advertisements

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License