FileMask problem with includes and excludes directories

Advertisement

Joe78
Guest

FileMask problem with includes and excludes directories

Hello,

Thank you very much for the great .NET assembly.
Unfortunately, I am having trouble with a rather complicated mask.

The folder structure from which synchronization should occur is as follows:
I:\project\2020\001__Projectname1\subfolder1\subfolder2
I:\project\2020\002__Projectname2\subfolder1\subfolder2
I:\project\2020\003__Projectname3\subfolder1\subfolder2
I:\project\2021\001__Projectname4\subfolder1\subfolder2
I:\project\2021\002__Projectname5\subfolder1\subfolder2
I:\project\2021\003__Projectname6\subfolder1\subfolder2
I actually have yearly folders from 2014–2024, and each year contains around 300 project folders. My program provides me with a list of about 50 folders from different years that I want to synchronize, but only those specific ones. So, I wanted to recursively include these parts of the path names, which are unique (e.g., 003__Projectname6), as directories to be considered. Additionally, I do not want to synchronize any files with some specific endings and do not want to synchronize any subfolder1 named MB-Projekt

The synchronization starts at I:\project.
opt = new TransferOptions();
opt.FileMask"*\002__Projectname2\; *\003__Projectname6\; | *.DMX; *.vps; *.ini; *.lock; */MB-Projekt/";
Unfortunately, there are issues with the directory being considered. While this directory is synchronized, its subdirectories and their files are not. How can I achieve this?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: FileMask problem with includes and excludes directories

With your file mask, I would expect nothing to be synchronized, as you are implicitly excluding the root year folders.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Joe78
Guest

Log-File

Actually, you are right, and thanks for the tip about the log file. I have adjusted the mask again. Now it synchronizes, but I can't manage to exclude the subfolder MB-Projekt. What else do I need to change?
opt.FileMask = "*/101__Projectname1/*/*; */119__Projectname2/*/* | *.DMX; *.vps; *.ftz; *.old; *.*.jpeg; *.doc; *.docx; *.ini; *.lock; ./Projekte/????/*/MB-Projekt/*"
Attached the log.file.
  • log.txt (877.5 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar

Re: Log-File

The root of your synchronization is the Projekte folder. The ./Projekte/????/*/MB-Projekt/* is resolved relatively to that. So it refers to non-existing Projekte/Projekte folder. The file mask should be ./????/*/MB-Projekt/*

Reply with quote

Joe78
Guest

Re: Log-File

thanks, but unfortunately, didn't help so far.
Attached the new log file.
It still syncronizes the MB-Projekte folder with all its subfolders.

Any other idea how the mask should be?
  • log1.txt (4.65 MB, Private file)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Log-File

Thanks. I cannot reproduce the behaviour you are seeing.
Let's start here:
. Local file 'I:\Projekte\2014' [2018-12-28T12:30:39.108Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2015' [2021-07-23T12:33:13.342Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2016' [2020-04-20T10:45:14.830Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2017' [2023-01-02T09:46:54.952Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2018' [2019-08-02T04:54:43.637Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2019' [2020-05-26T13:43:09.017Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2020' [2022-05-30T06:58:38.637Z] [0] excluded from synchronization
. Local file 'I:\Projekte\2021' [2023-09-26T13:16:15.212Z] [0] included to synchronization
. Local file 'I:\Projekte\2022' [2022-12-21T14:57:50.246Z] [0] included to synchronization
. Local file 'I:\Projekte\2023' [2023-12-22T08:56:32.548Z] [0] included to synchronization
. Local file 'I:\Projekte\2024' [2024-05-17T11:51:40.437Z] [0] included to synchronization
. Local file 'I:\Projekte\DATA' [2024-03-06T09:35:29.387Z] [0] excluded from synchronization
Is it intentional that 2021–2024 are included, while 2015–2020 are not? I do not see what causes that. For me, all year folders are excluded. And that's the behaviour I'd expect, because your mask still implicitly exclude all of them.

Reply with quote

Joe78
Guest

Re: Log-File

Yes, and thank you for sticking with it.

The fact that only the years 2021–2024 are included is indirectly caused by the allowed (sub)directories, which only occur in the years 2021–2024 (see the very beginning of the fileMask settings).

At the timestamp 2024-05-21 11:15:13.175, 4 directories are listed that are in the 2021 year folder and match the fileMask settings at the beginning. However, at the timestamp 2024-05-21 11:15:13.508, the subfolder ..\MB-Projekt is taken into account, which is incorrect due to the excluding conditions at the end of the fileMask settings.

Reply with quote

martin
Site Admin
martin avatar

Re: Log-File

But it doesn't work like that. Every folder level is evaluated independently.
WinSCP does not care what subfolders exist under 2021, when deciding if it should synchronize it.

Reply with quote

Advertisement

You can post new topics in this forum