Remove N day older file from an external location using pom.xml (maven) or Hudson

46 views Asked by At

To keep recently created 3 zip files from external folder location on disk and delete older zip files.Maven pom.xml are executed using Hudson use to create the zip file. How to do it using pom.xml or Hudson.

1

There are 1 answers

6
Jeanne Boyarsky On

Maven can delegate to other languages inside the POM. You could use GMaven and write that logic in Groovy. Or the Ant Run plugin to write that logic in Ant.

At that point, you have the steps to:

  1. Get a list of zip files in that folder
  2. Sort them
  3. Skip first three and delete others

You also probably want to have a profile so this only happens on your build server and not locally. Or points to a different location locally.