Problem with Excluding directories

Advertisement

ldsang
Joined:
Posts:
2

Problem with Excluding directories

Hello all. I've been trying to get WinSCP to exclude some directories from sync but have had some odd issues. Here's my basic script (run from a batch file):

option batch on
option confirm off
option transfer binary
option exclude "M:\mypath\localvars\*"
option exclude "M:\mypath\src\*"
option exclude "M:\mypath\obj\*"
open server:pass@99.99.99.99
synchronize remote M:\local\path /remote/path 
exit

The basic sync works, but it also completely syncs the "src" dir. Odd thing is it doesn't sync the "obj" dir. Also, it syncs 1 file in the "localvars" dir, but doesn't sync the rest of the files in that dir. I noticed this because I just put an additional file into that dir that I need different on my local server and the remote. There are other files that need to be different as well, but only 1 file in that dir is synced with my local server. Any ideas on why that script I posted would exhibit the behavior I've described?[/code]

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Problem with Excluding directories

1) "option exclude exclude_mask" is deprecated command, use "synchronize -filemask=|exclude_mask" instead.

2) Every "option exclude" command overwrites previous value. You need to set all masks at once by separating whem with semicolon. But of course, use the -filemask.

See example:
https://winscp.net/eng/docs/scriptcommand_synchronize#examples
And documentation:
https://winscp.net/eng/docs/file_mask

And of course, make sure you are using the latest version of WinSCP.

Reply with quote

guestuser
Guest

Exclude current directory not working

I am trying to exclude the current directory with: -filepath=|.\*
However, it is not excluding it... :?

Reply with quote

Advertisement

McSnoogins
Guest

Filemasks

I'm still a bit mixed up with the new file masks, can someone translate this for me please?

I used to use
option exclude c:\data\software

I've tried replacing it with
synchronize -filemask="|c:\data\software" remote -criteria=Both C:\Data\Software /Data/Software

But it seems to synchronize the data folder regardless. Can you show me what i should be using please?

Reply with quote

mcsnoogins
Guest

Re: Filemasks

McSnoogins wrote:

I'm still a bit mixed up with the new file masks, can someone translate this for me please?

I used to use
option exclude c:\data\software

I've tried replacing it with
synchronize -filemask="|c:\data\software" remote -criteria=Both C:\Data\Software /Data/Software

But it seems to synchronize the data folder regardless. Can you show me what i should be using please?


Last line should be "But it seems to synchronize the Software folder regardless"

Reply with quote

Mcsnoogins
Guest

Re: Filemasks

mcsnoogins wrote:

McSnoogins wrote:

I'm still a bit mixed up with the new file masks, can someone translate this for me please?

I used to use
option exclude c:\data\software

I've tried replacing it with
synchronize -filemask="|c:\data\software" remote -criteria=Both C:\Data\Software /Data/Software

But it seems to synchronize the data folder regardless. Can you show me what i should be using please?


Last line should be "But it seems to synchronize the Software folder regardless"



Bit of trial and error resulted in the following answer:

synchronize remote -criteria=Both -filemask="| Software/" C:\Data\ /Data/
Now synchronizing all files and folders but excluding the folder c:\data\Software

Reply with quote

Advertisement

You can post new topics in this forum