Delete multiple folders

Hi,

in addition to storing the installer binaries from our builds as artifacts in Continua we copy the installer files to a network share. Every build is copied to a seperate directory on the network share. At the moment I regularly check the network share for old build versions and remove them manually. I’d like to add a final step to our build process that removes all directories from the network share but leaves the directory of the current build untouched.

Is there a way to build a list of existing directories and remove all directories from this list? In that case I would fill this list before I create the new directory and remove the old directories after the new files were copied. I remember using a similar way in FinalBuilder to remove files.

Regards

Kay Zumbusch

We needed something similar but our requirement was to leave the last 5 builds on the network share.   

We could not find anything in the product.   We could have written a FinalBuilder script and call it, but instead we wrote a Delphi Program that is called at the end of the build.


Hi Kay,

There is no way to build up a list of directories in Continua, although there are a Delete and Delete Directory actions which you could use to delete existing files at the start of the build. The Delete action allows you to specify include and exclude patterns.  If the folders are named using build number, you can use $Build.BuildNumber$ in these patterns or use a variable and Set Variable actions to decrement the value if, for example, you want to exclude build number minus one.

We also recommend using a Finalbuilder action for this type of task. 
Note that Continua is designed  to work with FinalBuilder not replace it.

You can pass $Build.BuildNumber$ to FinalBuilder as a variable and then iterate back through the build numbers defining the folders to want to delete using variables and passing these to a Delete Directory action. You can also build up a list of directories to delete using FileSets within Finalbuilder with pattern and/or date-time filters.

Alternatively you can delete folders based on date using an Execute Program to call other programs such as Robocop.