filemask option does not seem to exclude anything

Advertisement

asmosoinio
Guest

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:

c:WinSCP.com /console /script=bat\backup_winscp_script.txt

With this script-file:

# Open predefined connection
open HQserver
# SYNC IT!
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

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
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@127.0.0.1
lcd b:\sync
cd /sync
lls
ls
synchronize remote -mirror -filemask="|*\_removed\; *\tmp\; *\*.zip; sessions\; t22loader_output.txt; */logs/; *\tmp_*; testdata\; *.pyc; *\*.pyc; .svn\; *\.svn\"

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

Searching for host...
Connecting to host...
Authenticating...
Using username "test".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] test@127.0.0.1
b:\sync
/sync
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 file2.zip
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
Comparing...
Local 'b:\sync' => Remote '/sync'
Synchronizing...
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

asmosoinio
Joined:
Posts:
2

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

Advertisement

You can post new topics in this forum