Select only specific-format files in subfolders, then download them

Advertisement

Coraz
Joined:
Posts:
3

Select only specific-format files in subfolders, then download them

First I'd like to say that it's the first time I'm trying to create a script, and I'm not a native English speaker, so learning a programming language like C# can be difficult for me.

What I'm trying to do is choose a directory (that much I can manage on my own), list all the files in the folder and the subfolders in the format .doc or .docx, then download them without regards to folder structure (I just want the files, not the folders). I figured after a bit of search that I would need .NET Assembly Line to accomplish this. Looking a bit around in this forum I found https://winscp.net/forum/viewtopic.php?t=14392, but I can't figure out a way to insert a filemask (or where to put it) and the pass the list output to the .NET equivalent of
mget
(I think I need to use this).

Could someone help me?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,762
Location:
Prague, Czechia

Re: Select only specific-format files in subfolders, then download them

So what language are you coding this in? C# or PowerShell?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,762
Location:
Prague, Czechia

This would do:

TransferOptions transferOptions = new TransferOptions();
transferOptions.FileMask = "*.doc;*.docs";
session.GetFiles("/remote/path/*", @"c:\local\path\", false, transferOptions).Check();

Reply with quote

Advertisement

You can post new topics in this forum