GetFiles with FileMask is skipping files

Advertisement

jrichardw
Joined:
Posts:
7

GetFiles with FileMask is skipping files

Hi, I'm using the following PS code to recursively download files. The files are mostly pdf files except for txt files that I create for testing. There is one file that will copy no matter what I use: I can use FileZilla or any other FTP client and I get a 550 permission denied on it. However, PS does not throw any sort of exception. The IsSuccess shows success, and of course the file doesn't copy. The session log doesn't show 550 or any other error; it just shows that it is skipping the file. That's the first issue.

The second issue is even on other files, that I can manually copy, my log shows that it is skipping the file. I'm trying to avoid attaching the log because the data is extremely sensitive data. The filenames contain names to my client's other customers. I would have to do a lot of redacting to attach a log file.

Any ideas on what is happening?

$transferOptions.FileMask = $f.FullName + $excludeDir               
$transfer = $session.GetFiles($getFiles, $localPath, $false, $transferOptions).Check()

Reply with quote

Advertisement

jrichardw
Joined:
Posts:
7

I've attached two screenshots of two of the files that will not transfer. If you look in the log, only one of the PDF files will transfer. You can ignore the test.txt files...they are ones that I created just to test out my code logic.

The filemask will indicate that the file that should be transferring but as you'll see for all but one file,it excludes them from the transfer and skips the file.
  • 2018-02-03 23_47_05-coldFTP.log - Notepad.png (7.26 KB, Private file)
  • 2018-02-03 23_44_48-coldFTP.log - Notepad.png (6.15 KB, Private file)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,513
Location:
Prague, Czechia

It's the comma in the file name. In file masks, the comma is a mask separator. If you want to use it literally, you have to double it:

-filemask="Underwriting_mmcisoedi16488000_Correspondence_CORR_20170504_Cotterman & Company,, Inc. A & M Real Estate,, LLC Red Conncection, LLC Cotterman & Cotterman,, Inc.______________C_Submission_M_mmcisoedi33388621_.pdf|*/"

See https://winscp.net/eng/docs/file_mask#combining

Reply with quote

jrichardw
Joined:
Posts:
7

Ah!!! Okay...good catch! Thanks!!


martin wrote:

It's the comma in the file name. In file masks, the comma is a mask separator. If you want to use it literally, you have to double it:

-filemask="Underwriting_mmcisoedi16488000_Correspondence_CORR_20170504_Cotterman & Company,, Inc. A & M Real Estate,, LLC Red Conncection, LLC Cotterman & Cotterman,, Inc.______________C_Submission_M_mmcisoedi33388621_.pdf|*/"

See https://winscp.net/eng/docs/file_mask#combining

Reply with quote

Advertisement

You can post new topics in this forum