Topic "Downloading empty folder when using filemask"

Author Message
tkennedy
[View user's profile]

Joined: 2012-10-26
Posts: 11
I am using the following few lines in my Powershell script to retreive files according to a file mask.

Code:
$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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
There is no way to exclude empty folders from transfer.
_________________
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