Re: Using wildcards to access SFTP directory
If I understand it correctly, you want to combine these two:
order_034/item_229
and today it would be order_882/item_002
. There will be multiple order/item pairs. Within each order/item pair, there will be multiple files of format File_YYYY_MM_DD
file_*
that are within X days of today's date. This means looking at all order/item pairs. If X = 0 then that means only return order/item that equals to today's date. I forgot to include the X days part earlier. Sorry about that.
var opts = EnumerationOptions.MatchDirectories;
var order = session.EnumerateRemoteFiles("/", "order*", opts).First();
var orderPath = order.FullName;
var item = session.EnumerateRemoteFiles(orderPath, "item*", opts).First();
var source = RemotePath.Combine(item.FullName, "file_*");
transferResult = session.GetFiles(source, @"C:\Users\Me\To_Be_Processed\", false, transferOptions);
order
and item
.
TransferOperationResult transferResult;
transferResult =
session.GetFiles("/order_000053922/item_000098300/file_*", @"C:\Users\Me\To_Be_Processed\", false, transferOptions);
TransferOperationResult transferResult;
transferResult =
session.GetFiles("/order_*/item_*/file_*", @"C:\Users\Me\To_Be_Processed\", false, transferOptions);
*
like this. It complains. How would I code this so I can use *
like noted?