powershell $session.GetFiles

Advertisement

unterstreichung
Joined:
Posts:
1
Location:
New York

powershell $session.GetFiles

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,552
Location:
Prague, Czechia

Re: powershell $session.GetFiles

Make sure the $remotePath ends with a slash.

If this does not help, please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum