Post a reply

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: EnumerateRemoteFiles in Perl

Ajay wrote:

Would you know how the syntax would look like for EnumerateRemoteFiles in Perl.

You cannot use EnumerateRemoteFiles in Perl, as documented:
The method cannot be used via COM interface
Ajay

EnumerateRemoteFiles in Perl

Hi,
Would you know how the syntax would look like for EnumerateRemoteFiles in Perl.

My requirement here is to find out if the files with wildcard are available in remote server or not. However i am struggling to find the syntax for winscp perl module to achieve the same.

Constructed the following command without much luck.

my $files =$session->EnumerateRemoteFiles('/data/incoming', '*.txt','EnumerationOptions_None');

Your assistance would greatly help.

Thanks
Ajay
Silviu Preda

Thanks man, appreciate it, will investigate.
martin

No it's not.

For EnumerateRemoteFiles, if you need to skip a folder, you either have to filter the results to exclude files in the folder. Or, if you actually need to skip that folder (because it's not accessible or it's time consuming to enumerate it), you will have to do your own custom enumeration. It's not difficult. Check the source code of the .NET assembly.
Silviu Preda

Thank you for that. Is that also valid for the
EnumerateRemoteFiles
method? Because that's really where I need it.

Thanks
martin

Re: File mask in EnumerateRemoteFiles

What does you mean by "pick up"?

Do you want to download all PDF files from all folders except for Reference?

TransferOptions transferOptions = new TransferOptions();

transferOptions.FileMask = "*.pdf | Reference/";
session.GetFiles("/*", @"C:\local\path\*", false, transferOptions).Check();
Silviu Preda

File mask in EnumerateRemoteFiles

Hi,

I have the following use case: I need to pick up all .pdf files from a FTP location root folder, but I need to exclude one folder, called Refference.
Code:
IEnumerable<RemoteFileInfo> directoryInfo = session.EnumerateRemoteFiles("/", "*.pdf |*/Reference/", EnumerationOptions.AllDirectories);


My mask is not ok, because now it excludes all files.

Testing:
directoryInfo.ToList().ForEach(di =>

                {
                    Logger.Information(di.FullName);
                });


When running without the
|*/Reference/
part, i get all the files, correctly, but when I add it, nothing is listed. How should I format my mask?

Thank you.

Silviu