Topic "Problem with Excluding directories"

Author Message
ldsang
[View user's profile]

Joined: 2013-03-12
Posts: 2
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):

Code:
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]
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/scriptcommand_synchronize#examples
And documentation:
http://winscp.net/eng/docs/file_mask

And of course, make sure you are using the latest version of WinSCP.
ldsang
[View user's profile]

Joined: 2013-03-12
Posts: 2
Semicolons, that was my problem. One of the perils of using search is getting info on depreciated commands. Thanks!
guestuser

Guest


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

Guest


i just updated to newest version, works great now!
McSnoogins

Guest


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?
mcsnoogins

Guest


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"
Mcsnoogins

Guest


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
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