Suppose I have a destination folder structure that looks like this:
D:\DEPLOY\DEST
│ 0.txt
│
├───a
│ a.txt
│
└───b
├───b1
│ │ b1.txt
│ │
│ ├───b1a
│ │ b1a.txt
│ │
│ └───b1b
│ b1b.txt
│
└───b2
b2.txt
I also have a source folder structure that looks like this:
D:\DEPLOY\SOURCE
└───b
└───b1
└───b1a
b1a-new.txt
I would like to synchronize the source to the destination, but only below the \b\\b1\b1a
path. To do that, when running MSDeploy, I add a skip rule matching all dirPaths not containing this path:
msdeploy -verb:sync
-source:contentPath=D:\deploy\source
-dest:contentPath=D:\deploy\dest
-skip:skipAction=delete,objectName=dirPath,absolutePath='(?!\\b\\b1\\b1a)'
-whatif
resulting in:
Info: Deleting file (D:\deploy\dest\0.txt).
Info: Deleting file (D:\deploy\dest\b\b1\b1.txt).
Info: Adding file (D:\deploy\dest\b\b1\b1a\b1a-new.txt).
Info: Deleting file (D:\deploy\dest\b\b1\b1a\b1a.txt).
Total changes: 4 (1 added, 3 deleted, 0 updated, 0 parameters changed, 0 bytes copied)
To my surprise, this does more than expected. MSDeploy also deletes the files 0.txt
and b1.txt
, which are under a dirPath that I expect to be skipped based on the regex. I tried various permutations of the absolutePath regex, but to no avail.
What should I be doing instead? Or is this beyond the possibilities of msdeploy?
Note: this example is simplified. In reality my source is package, not a contentPath. That is why the obvious answer of syncing at the b\b1\b1a
-level would not apply.