1
votes

I have an Azure DevOps Windows Machine File Copy task that is deploying a build artifact to a remote server. I would like to be able to clean the target directory excluding specific files/folders. My use case is that my app generates logging information that I don't want wiped on redeploy.

The Windows Machine File Copy task only seems to contain a checkbox option for "clean." I'd love to be able to use something like the Delete Files task minimatch patterns.

1

1 Answers

2
votes

I'd love to be able to use something like the Delete Files task minimatch patterns.

If the files you want to delete are located on remote machine, you could use Powershell task or RemoteDelete task to delete the files.

For powershell task, there are many powershell script on the web to delete files from remote machine, like:

Remote delete file with Powershell

For RemoteDelete task, we need input your remote machine’s IP, username and password, there are also two options Include Items and Exculde Items.

Hope this helps.