Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: GetFiles with Remove set to true deletes empty directory - Me Too

You DO have the same syntax error as OP.
It should be:
result = session.GetFiles("/test/from/*", @"c:\temp\", true, options);


Or simply:
result = session.GetFiles("/test/from/CM_*_*.ager.txt", @"c:\temp\", true);

(no TransferOptions)
wrusselmslc

Re: GetFiles with Remove set to true deletes empty directory - Me Too

Don't have the same syntax error as OP:
using Session session = new Session();
session.Open(sessionOptions);
 
var options = new TransferOptions();
options.OverwriteMode = OverwriteMode.Overwrite;
options.PreserveTimestamp = true;
options.TransferMode = TransferMode.Binary;
options.FileMask = "CM_*_*.ager.txt";
 
result = session.GetFiles("/test/from/", @"c:\temp\", true, options);

Running this code will pull all files that match the mask, but if there are no more files in the FTP directory, the from directory is deleted as well. If there are no files in the from directory at all, it will still delete the from directory.
david.vangeest@...

GetFiles with Remove set to true deletes empty directory

When executing GetFiles on a server with an empty directory, WinSCP is sending a command to delete the actual directory the files are stored in. Here's how I have the command setup:
session.GetFiles("/", _mySettings.DownloadDirectory, true, transferOptions)

This is not the behavior I expected.