Topic "synchronize local with include and exclude masks"

Author Message
DenimKnight

Guest


Hi there,

Really impressed with WinSCP but I've ran into an issue. I'm trying to synchronize local path with remote path and have to have an exclude mask and an include mask. For example I want to exclude folder a with a file path of /sftp/file/a but include all other folders (/sftp/file/b and /sftp/file/c) and within those folders I want to synchronize FileA.* and FileB.*

Any pointers on what the script should looks like to do that? Is it possible?

Thanks

Alex
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
Sorry, that's too vague.

What is a root folder of the synchronization?

What about files in other (sub)folders (if there are any)? What about files in the synchronization root folder?
DenimKnight

Guest


Hi Martin,

Sorry about being vague, was trying to keep it general so that it other users in the same boat could benefit as well.

On the FTP Server

The FTP site gets updated daily, the files are stored in monthly folders (yyyyMM). There are no other sub folders. There is one folder on the FTP site that I want to exclude entirely which has the path (/sftp/file/000001) When the FTP user connects it defaults to folder path /sftp/file/

Within each of the monthly folders there are various files, there are 4 file names that get repeated with different file extensions (ATM01.*, ATM02.*, AMT03.* and ATM04.*), there could be other file names in there that I don't want (eg ATM08.*) but I don't know for sure what they will be so I only want to include the files that start with the 4 names given with any file extension after that name. (eg ATM01.txt, ATM01.csv...etc).

On Local Machine

On the local machine the file path is H:\sftp\file\ and it should replicate the monthly folder structure.

So I want to synchronize from the Remote (FTP) server to the local machine based on the rules given above.

Is that enough information for you?

Hope you can help.

Thanks

Alex
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
OK, this should do:
synchronize local H:\sftp\file /sftp/file -filemask=ATM01.*;ATM02.*;ATM03.*;ATM04.*;*/|000001/

- Include all folders */, except for 000001/
- Include only files ATM01.*;ATM02.*;ATM03.*;ATM04.*

Reference: https://winscp.net/eng/docs/file_mask
DenimKnight

Guest


Thanks Martin that worked great!

Cheers

Alex
Advertisements

You can post new topics in this forum

Search

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