msdeploy并跳过未命名为x的目录

msdeploy并跳过未命名为x的目录

问题描述:

我正在尝试跳过除目录之外的所有目录-模板目录-但我无法使其正常工作.模板目录包含在跳过的目录中,或者,如果我从正则表达式的开头删除\,则会跳过整个MyTestWebsite目录....

I'm trying to skip all directories apart from one - the Templates directory - but I can't get it to work. Either the Templates directory is included in the skipped directories or, if I remove the \ from the start of the regular expression, I skip the whole MyTestWebsite directory....

"C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy.exe" 
-verb:sync -source:contentPath="MyTestWebsite" 
-dest:contentPath="MyTestWebsite",computerName=Server2 
-skip:objectName=dirPath,absolutePath=\\(?!^Templates\\$).* 
-skip:objectName=filePath,absolutePath=keepalive\.htm -whatif

很可能是我的正则表达能力让我失望,所以我欢迎任何帮助.

Most likely it is my regular expression skills letting me down so I'd welcome any help.

谢谢 马特

您在正确的路径上,但是您的^$应该位于表达式的远端:

You were on the right path, but your ^ and $ should have been at the far ends of the expression:

-skip:objectName=dirPath,absolutePath=^(?!\\Templates\\).*$