Ability to automatically remove files/folders no longer in build from deployment target

justin.baker's Avatar


10 Jan, 2017 07:04 PM

Is there a way to have Octopus automatically remove any files/folders that no longer exist in a package from the deployment target? I know you can purge the directory first, but this is not the option we want to use. Instead, say a folder named "Test" with some files under it is currently deployed, but a newer build removes that, we would like to have it also removed from the target when the deployment happens. I'm sure there has to be a way to do this and I hope the collective wisdom here can point me in the right direction.


  1. Support Staff 1 Posted by Daniel Fischer on 11 Jan, 2017 08:20 AM

    Daniel Fischer's Avatar

    Hi Justin,

    Thanks for getting in touch! Unfortunately, there is no way in Octopus to do what you are after here. This is one of our thought processes behind not making Custom Installation Directory a default enabled feature. The default method that Octopus uses to manage its directories covers this by creating a new directory for every deployment. This also enables you to redeploy a previous version quickly if there is an issue with the newest release.

    The only ideas that come to mind are as follows. The first being to purge the directory, but as you say that’s not an option. I believe creating a custom post-deploy script would be the only way that you could manage this.

    Sorry for the bad news.

    Best regards,

  2. Paul Stovell closed this discussion on 11 Apr, 2017 02:15 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac