5

As part of my install scripts for Visual Studio Online (VSO / VSTS) I delete the files in my directory shortly after uninstalling the services.

We have configuration files and logs that I'd like to preserve but everytime I try to tell the 'Delete Files Task' to ignore those files it deletes them anyway.

What I want is for ALL files in the Bifrost directory to be deleted except for

  • The Logs folder
  • App.Connections.Config
  • App.Queues.Config

Can someone help please?

enter image description here

Chris
  • 26,744
  • 48
  • 193
  • 345

1 Answers1

4
  • If the files you want to delete are located in the agent folder or the subfolder of the agent machine, you can use Delete Files Task. Because the Source Folder of Delete Files Task can only be specified for the agent machine.
  • If the files you want to delete are located on another remote machine, you should 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.

    For RemoteDelete task, you can set as below:

    Input your remote machine’s IP, username and password.

    Path: the directory for Bifrost folder, such as D:\test\Bitfrost

    Include Items: folders and files you want to delete and separate with comma (,). Such as delete folder temp and file *.txt, you can specify with temp,*.txt

    Exculde Items: folders and files you want to keep. For you situation, you should specify as Logs,App.Connections.Config,App.Queues.Config

    Note: the Include Items option can't leave empty or use **, otherwise it will delete all the files and folders in Bifrost.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • i am also working on the same logic need to delete whole folder except 3 folder, how i can use 'Delete File' ?? – Saad Awan Sep 02 '20 at 11:45