3

In TeamCity 8.1 I've just pulled down my source code and the first thing I want to do is delete a bunch of subfolders from what I've just retrieved.

I can't use exclusions in the 'Checkout Rules' so I guess I need a separate step to run immediately after retrieving source code.

I guess I need a CommandLine Step? If so I can't seem to find much information about using this to delete a number of sub folders?

enter image description here

Anyone with experience in this area?

Rajesh
  • 7,766
  • 5
  • 22
  • 35
Lee Englestone
  • 4,545
  • 13
  • 51
  • 85

2 Answers2

0

You can do it in two ways

  1. use a command line to delete the folders using windows/unix commands. Teamcity publishes a property called teamcity.build.checkoutDir using which you can go the directory and run the necessary delete commands(based on the OS where you are checking out).

  2. A better way of doing this would be to add a target in your build.xml and call the target as the first step of your build

Biswajit_86
  • 3,661
  • 2
  • 22
  • 36
0

In our team city setup we wanted to delete all existing files in working directory.

We have first build step which cleans up working directory contents using custom command line script.

del /s /q .
for /d %%%y in (.\*) do @rd /s /q "%%%y"

Note: We don't have VCS attached in this build configuration. If you have VCS attached then this solution won't work because TC will first download/copy contents from VCS then this build step will delete all the contents downloaded from VCS.

TeamCity snapshot

Rohit
  • 6,365
  • 14
  • 59
  • 90