Ignore folders during deployment synchronization

I’m deploying a website to Azure App Service which has a folder containing user generated files. In the deployment step I have already unchecked the ‘Remove additional files’ option to make sure that these files are not deleted, but in the deployment logs I’m seeing messages like this one for every file in that folder:

“Delete operation on filePath ({{FILE_PATH}}) skipped because of rule DoNotDeleteRule.”

The issue with this is that if there are a lot of files, the deployment takes quite some time to complete. Is there a way to ignore this folder ?

WebDeploy has a ‘skip’ flag for this (https://technet.microsoft.com/en-us/library/dd569089(WS.10).aspx). I think that this flag is already used by Octopus for the ‘Preserve App_Data’ setting. Is it possible to specify other folders too ?


Hi David,

Thanks for getting in touch.

You are correct. The “Preserve App_Data” flag does populate skip rules in Calamari when deploying Azure Web Apps.

For your situation, we believe the section on “Preserving Specific Paths When Deploying Azure Web Apps” from the Web App concepts guide will show an example of how to do this with regex. You’ll just need to follow the example carefully, because yea, regex :slight_smile:

Let me know how you go.


Thanks, have tried the setting but it doesn’t seem to help. The files and subfolders in the ignored folder are still being iterated.

Since I want to ignore a folder called “pdfs”, have added this variable as advised with the following value:

Octopus.Action.Azure.PreservePaths = \\pdfs

have also tried like this:

Octopus.Action.Azure.PreservePaths = \\pdfs.(\\.|$)

But it has the same effect, only the log messages are slightly different:

For each subfolder:
Delete operation on dirPath ({{DIR_PATH}}) skipped because of rule SkipDeleteDir_0.

and for each file:
Delete operation on filePath ({{FILE_PATH}}) skipped because of rule SkipDeleteFiles_0.

This behavior is because the iteration seems to be made before checking the ignore rules, so even if you specify an ignore rule for a folder, its contents will still be iterated.

Is there a way to ignore a folder completely, without iterating its contents ?


Hi David,

We experimented with this and we think we understand what’s happening now.

So your app package has an empty folder called “pdfs” in it, which has been deployed to Azure … and users have then populated it with many subfolders and various pdf files, is this correct?

If this is the case, the only way we could find to get web-deploy to NOT iterate through all the subfolders/files during a deployment is to remove that empty “pdfs” folder from your app package.

Web-deploy will leave the folder intact because you have unticked the “Remove additional files” option from the step. Because your package now does not include an empty “pdfs” folder, web-deploy won’t then try to compare it with the existing pdfs folder that already exists on your target (which seems to be the cause of web-deploy then iterating through everything in this folder and having to apply delete rules on all the sub-things).

The PreservePaths variable won’t apply in your situation, since you already have the “Remove additional files” unchecked (sorry for the confusion). That variable is used when you want to remove folders/files on the target except for things that match the preserved regex conditions.

Hope this helps.


That was exactly it. Have removed the “pdfs” folder from the project and now the deployment process ignores it.

The reason why the folder was included in the project is that I wanted to ensure that it is being created during deployment (along with its predefined subfolders). But this is also handled in the code of the project, so it is not necessary anymore.

Thanks for the help and for the detailed responses.

No worries David, glad we got it sorted :slight_smile: