I have setup an Azure pipeline, that runs on an op-premises agent, that performs Windows Machine File Copy task, which uses Robocopy to copy files from my computer to a remote server.

The copied files are a .net core application.

  1. I am adding a file app_offline.htm to stop new incoming trafic using Windows Machine File Copy task
  2. I am copying all the application files to the destination using the Windows Machine File Copy task
  3. I am trying to remove the app_offline.htm using Windows Machine File Copy task this time using /Purge

As i read using /Purge checks source and destination folders for differencies and deletes the extra files or folders in the destination

In the 3 step: How can i exclude all the files from the copy operation and using /Purge it will find that only the app_offline.htm file is not in the source folder and deleting it from destination

I am using e.g:/xf appsettings.json to exclude one file from copying, is there a way to exclude everything except one file.

There is no Delete File task in Azure pipelines regarding the remote server and using Powershell is restricted from firewall rules.


  • Using /PURGE /XF * doesnt delete the app_offline.html – G. Siganos Jun 21 '19 at 7:44

I figured in out by adding app_offline.htm /Purge

It deletes the file since it is not found in the source and doesnt copy the rest of the files again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.