Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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: How can we include a directory (with all files) and sub-directories (with all files)?

@GiordanoMalik: All subdirectories will all files are included by default. If you have problems, we need more details about what are you trying to achieve. Please start your own question.
GiordanoMalik

How can we include a directory (with all files) and sub-directories (with all files)?

How can we include a directory (with all files) and sub-directories (with all files)?

I tried also this:
$transferOptions.FileMask = "*/Docs/*.*"

Also this:
$transferOptions.FileMask = "*/Docs/*"
DenimKnight

Problem solved!

Thanks Martin that worked great!

Cheers
Alex
martin

Re: synchronize local with include and exclude masks

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

Re: synchronize local with include and exclude masks

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

Re: synchronize local with include and exclude masks

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

synchronize local with include and exclude masks

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