admin wrote: ↑17 Sep 2022 18:08
H
exclude: Check out the
sync command in scripting. It offers a
filter parameter to specify a list of patterns or full paths, separated by "|", used to include or exclude files or folders in/from the operation by name. Here, for example, I exclude the appdata\ folder when backing up my source code:
Code: Select all
sync "E:\XY\XYplorer.dev\code\", "I:\bup.snap\XY-code-<date yyyy>\<date yyyymmdd> (<xyver>)\", 1, 0, 0, "ckn", 7:="-appdata\";
Overall goal: bi-directional sync of only a subset of a folder structure with
smart deletions on the "way back".
Scenario
(Master) Source:
d:\aDir\A
d:\aDir\B
d:\aDir\C
d:\aDir\D
Target: w:
To stay unsynced:
aDir\A, aDir\B\skip
The working "Forward": sync master source -> target:
Code: Select all
sync "d:\aDir", "w:", 1, 0, 4, "ckn", 7:="-d:\aDir\A\|-d:\aDir\B\exclSubdir";
This works, of course, fine.
Now, "simply" reversing the direction using "-r" as additional switch
Code: Select all
sync "d:\aDir", "w:", 1, 0, 4, "cknr", 7:="-d:\aDir\A\|-d:\aDir\B\exclSubdir";
doesn't work as
d:\aDir\A\ or aDir\A\ and
d:\aDir\B\exclSubdir or aDir\B\exclSubdir would get deleted which is unwanted this direction.
The
sync manual does state:
- "All matching is done against source items, not target items." (1)
- ...
- "The filter also affects deletions in target, sync caps, preserve all item dates." (2)
According to (1) the reverse deletion is expected, but what does (2) then mean?
Given the current
sync implementation is there a way to accomplish my goal?
To complicate things further there's
another, longer standing wish asking for the opposite.
I don't think changing the existing semantic of the "+" and "-"-prefixes is an "easy" approach, neither is adding new bit field values to parameter
delete_items.
But how about adding a new prefix "!" with the meaning of a
global, direction-unaware ignore?