Topic "Script to download files non-recursively - failing permission denied"

Author Message
[View user's profile]

Joined: 2017-03-14
Posts: 2
Hi, I'm trying to download files from an Sftp site with a basic power shell script based on the excellent one from here. I'm trying to download files ending with created in the last day from the root of the XML directory. The files are only from the root as the ID I'm using to access the directory doesn't have permissions to the sub directories. However when the script runs it doesn't download anything as it fails with the error below. The directory 1000 is one the ID has no permission too.

Error listing directory '/XML/1000'.
Permission denied.
Error code: 3

Error message from server (en): Permission denied.

The file mask I'm trying is FileMask = "*>=1D|*/"

Any help would be greatly appreciated. Script file attached.
winscp.pullsftp.txt (1.66 KB) [Download]

Description: power shell script

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27083
Location: Prague, Czechia
Your code looks OK to me, except that $remotePath should probably be "/XML/*". Or even "/XML/*>=1D" straight away (and you won't need the TransferOptions).

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.
[View user's profile]

Joined: 2017-03-14
Posts: 2
Thanks Martin, that's fixed the issue. Setting the file mask in the remote directory variable stops the lack of permissions to the sub directories causing the problem.

Many Thanks

You can post new topics in this forum


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