Topic "powershell $session.GetFiles"

Author Message
interiis
[View user's profile]

Joined: 2017-05-03
Posts: 2
Hello WinSCP forums

I'm having a bit of a strange problem that I hope you guys can help me with.
I've produced a powershell script, which contacts an ftp server, deletes files based on one mask before downloading based on another.
The connection is made and my script deletes successfully, but when it comes to downloading I get "No such file or directory."

The relevant line reads
$downloadResult = $session.GetFiles(($remotePath + "ftpPINVOI*.*"), $localPath, $True, $transferOptions)
The filenames have a structure of ftpPINVOI_[timestamp]_[number].txt
Timestamp and number are just digits, nothing more.

winscp v577
WinServer 2008 R2

/HLM
interiis
[View user's profile]

Joined: 2017-05-03
Posts: 2
I found the culprit insofar that I was attempting to delete the file after download, while the server is set to do so automatically.
Switching the third argument to $False lets the script run without error and still removes the file after download.

/HLM
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