ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject Re: Task to prune files
Date Mon, 20 Sep 2004 16:27:30 GMT
You need to use the date selector:
http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect

Peter

Milind Rao wrote:

>I create war files using timestamps so I can get back to a previous
>war file easily.  The drawback to this is that I end up with a lot of
>war files that I'd like to prune.  The war files have the format
>yyyy_MM_dd_app.war.  I calculate the time using the TStamp task.  I
>can use the same task to offset by say a week to search for files that
>need to be pruned.  The problem is that I end up with a specific day's
>files.  eg. if I were to run the prune task below
>
>	<tstamp>
>		<format property="LASTWEEK" offset="-1" unit="week" pattern="yyyy_MM_dd"/>		
>	</tstamp>
>	
>	<target name="pruneWARFiles">
>		<copy todir="${jar_dir}/tmp">
>			<fileset dir="${jar_dir}">
>				<include name="${LASTWEEK}*.war"/>
>			</fileset>
>		</copy>
>	</target>
>
>I'd end up with the war file generated for  the 13th today being the
>20th. (I'm using copy instead of delete right now for testing).  The
>problem is that I don't get war files for the 8th or the 7th etc. 
>What I need is a filter that will select all files less than or equal
>to a week ago.
>
>Before I go about creating a custom prune Ant Task, I'd like to check
>that this can't be achieved using the built in Ant Tasks.
>
>Thanks.
>
>  
>


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


Mime
View raw message