Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Downloading empty folder when using filemask

There is no way to exclude empty folders from transfer.
tkennedy

Downloading empty folder when using filemask

I am using the following few lines in my Powershell script to retreive files according to a file mask.

$GetFileMaskString = "SLEXTRACT*.PGP; MCEXTR*.PGP"


# Use the $transferoptions file mask property for the file mask
$transferoptions.FileMask = $GetFileMaskString

# Download the files according to the file mask stored in transferoptions
$Session.GetFiles("$ServerPath", "$DLPATH", $false, $transferoptions).Check()


This does successfully download the files, but there is an empty directory above the files on the server, and when I use the file mask, this empty folder gets downloaded also. For example:

FTP Server
----------
EMPTY_FOLDER
SLEXTRACT20131203.PGP
MCEXTR20131203.PGP

When the download is complete, I have successfully downloaded.

EMPTY_FOLDER
SLEXTRACT20131203.PGP
MCEXTR20131203.PGP

How can I prevent this empty folder from being downloaded as well?

##
WinSCP Version 5.1.4 (Build 3020) (OS 6.1.7601 Service Pack 1)
Windows Server 2008 R2 Enterprise
Using SFTP Protocol
.NET Assembly from Powershell