Topic "Synchronize -filemask in .NET Assembly?"

Author Message
3K
[View user's profile]
Donor
Joined: 2012-01-20
Posts: 34
Location: Geneva
Hi, what is the equivalent scripting command of filemask in .NET Assembly as shown below?

Script:
synchronize -filemask="*.doc*<2012-02-01; *.ppt*<2012-02-01" local "C:\TEST\docs" "/docs"

In .NET assembly, what will be the filemask command?
synchronizationResult =
session.SynchronizeDirectories(
SynchronizationMode.Local, @"C:\TEST\docs", "/docs", false);

Thank you.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
That would be:
Code:
session.SynchronizeDirectories(
    SynchronizationMode.Local, @"C:\TEST\docs", "/docs", false,
    options: new TransferOptions { FileMask = "*.doc*<2012-02-01; *.ppt*<2012-02-01" });


Read more here:
https://winscp.net/eng/docs/library_session_synchronizedirectories
https://winscp.net/eng/docs/library_transferoptions
3K
[View user's profile]
Donor
Joined: 2012-01-20
Posts: 34
Location: Geneva
Thank you. Very Happy
John Thomas
[View user's profile]

Joined: 2013-06-27
Posts: 2
Location: Malaysia
Does the same Filemask syntax apply to session.PutfFiles also?

I need to transfer all the files in a directory without including any sub directories and delete source files on successful transfer.
Will the following code work?

TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FileMask = "*.*| */";

session.PutFiles(source\*, target, true, transferOptions);
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
John Thomas wrote:
Does the same Filemask syntax apply to session.PutfFiles also?

I need to transfer all the files in a directory without including any sub directories and delete source files on successful transfer.
Will the following code work?

TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
transferOptions.FileMask = "*.*| */";

session.PutFiles(source\*, target, true, transferOptions);

Your code looks good. Any problems?
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License