filemask option does not seem to exclude anything



filemask option does not seem to exclude anything

I have not been able to get -filemask to ignore any files. I have tried with spaces after the ;-character, ""-characters around the option, changing / to \ etc. I would like to ignore all files in the logs/ -directory, and all files in all .svn directories.

I am using WinSCP, Version 5.0.7 (Build 2268) on Windows XP.

I run this command: /console /script=bat\backup_winscp_script.txt

With this script-file:

# Open predefined connection
open HQserver
synchronize remote -mirror -filemask="|*\_removed\; *\tmp\; *\*.zip; sessions\; t22loader_output.txt; */logs/; *\tmp_*; testdata\; *.pyc; *\*.pyc; .svn\; *\.svn\"
# Touch a file on the replica -- this can be used to show "last updated"
touch updated

The output still shows that for example files in .svn and logs-directory are synced:

E:\...\.svn\entries       |          1 KiB |    0.0 KiB/s | binary | 100%
Local 'E:\thewebsite\docs_etc\.svn' => Remote '/cygdrive/c/Users/HQserver/thewebsite/docs_etc/.svn'
E:\...\.svn\entries       |          0 KiB |    0.0 KiB/s | binary | 100%
Local 'E:\thewebsite\logs' => Remote '/cygdrive/c/Users/HQserver/thewebsite/logs'
E:\...\bin_generator.log  |        855 KiB |   38.2 KiB/s | binary |  34% ...

Reply with quote


Site Admin
martin avatar
Prague, Czechia

Re: filemask option does not seem to exclude anything

I do not see anything wrong about your script.

I've tried the same and it works for me:

open test@
lcd b:\sync
cd /sync
synchronize remote -mirror -filemask="|*\_removed\; *\tmp\; *\*.zip; sessions\; t22loader_output.txt; */logs/; *\tmp_*; testdata\; *.pyc; *\*.pyc; .svn\; *\.svn\"

Neither .svn folder, nor were synchronized, while file4.txt and "folder" were.

Searching for host...
Connecting to host...
Using username "test".
Authenticating with pre-entered password.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] test@
24/05/2012  08:36    <DIR>          ..
24/05/2012  08:30    <DIR>          .svn
28/03/2012  09:14             2,776 file1.txt
13/01/2012  12:00               241
17/02/2012  12:16             2,369 file3.txt
08/02/2012  11:38             1,291 file4.txt
24/05/2012  08:36    <DIR>          folder
Drw-rw-rw-   0                           0 May 24  9:36:42 2012 .
Drw-rw-rw-   0                           0 May 24  9:36:42 2012 ..
-rw-rw-rw-   0                        2677 Mar 28  9:14:53 2012 file1.txt
-rw-rw-rw-   0                        2271 Feb 17 12:16:03 2012 file3.txt
Local 'b:\sync' => Remote '/sync'
Local 'b:\sync' => Remote '/sync'
b:\sync\file4.txt         |          1 KiB |    0.0 KiB/s | ascii  | 100%
b:\sync\folder            |          0 KiB |    0.0 KiB/s | ascii  |   0%

If you do not manage to resolve this, send me an email, so I can send you back a debug version of WinSCP to track the problem. Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.

Reply with quote


Thanks for your fast reply!

After knowing that the script should work correctly, I took a deeper look into my script file, and found a \0, i.e. ASCII value zero, character in it! Seems that the parser stopped at that char and silently ignored the rest of the mask.

May I suggest:
- Would be nice to get some more feedback about how the filemask was parsed. For example if one could get a list of the files to be synced, and the ones excluded, without actually synchronizing? Would make testing cases like this much faster -- actually running the sync can take a very long time.
- And throwing a warning when there is such odd character in the script would be good as well.

Anyways, thanks for a great app, saved the day for me! All other sync solutions I tested were failing miserably...

Reply with quote


You can post new topics in this forum