ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tuckers <matthew.tuckn...@gmail.com>
Subject Deleteing Diretories by date (that contain files with different dates)
Date Sat, 16 Jul 2011 09:32:27 GMT
Hi,

I use Jenkins to create a set of directories that can be put on a DVD and
installs the software app we create.

This happens nightly so gets big quickly. What I want to do is remove any
directory and sub-directories that are greater than n-days old. 

The rule should be purely based on the top directories

i.e.

dvdInstalls\IT6B5_14_07_2011
dvdInstalls\IT6B5_13_07_2011
dvdInstalls\IT6B5_12_07_2011
dvdInstalls\IT6B5_11_07_2011
dvdInstalls\IT6B5_10_07_2011

the dvdInstalls directory contains txt files that should not be removed.

So if I set the offset in timestamp to -4 I want the script to completely
remove the 12/07, 11/07 and 10/07 directories.

Each of the top level directories have many sub directories and files (the
files may have a different time stamp aswell as the subdirectories).

I have almost got an ant script that works but just need the last bit.

The script looks something like



  <tstamp> 
      <format property="delete.timestamp" pattern="MM/dd/yyyy HH:mm aa" 
              offset=-5/> 
    </tstamp> 

        
        <delete includeemptydirs="true" verbose="true"> 
          <dirset dir"${baseDir}" ">	   
           &lt;exclude=&quot;*txt&quot;/&gt;
            <date datetime="${delete.timestamp}" when="before"
checkdirs="true"/> 
          </dirset> 
        </delete> 


What this seems to do is remove some directories but not all of them and
some files. I'm sure this is very close. Can anyone help?


Cheers

Tuckers



--
View this message in context: http://ant.1045680.n5.nabble.com/Deleteing-Diretories-by-date-that-contain-files-with-different-dates-tp4593479p4593479.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message