ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <li...@bitfaeule.net>
Subject AW: use fileinfo in ant
Date Tue, 07 Dec 2004 19:58:01 GMT

Jan,

Thank you for your help. I was able to solve my problem :)

A question remains: My solution seems more complicated than I would
epect it to be. For instance I want to delete some directories if they
are older than 7 days. My solution looks as follows:
I first need to delete all the files in the directories, then I delete
all the empty folders, here is my code:
                     <tstamp>
			<format property="sevenDaysAgo" 
					pattern="MM/dd/yyyy hh:mm aa"
					offset="-7"
					unit="day"/>
		</tstamp>
		<echo message="deleting all builds older than ${sevenDaysAgo}"/>
		<delete includeemptydirs="true" verbose="false">
			<fileset dir="${release}" includes="**">				
				<and>
					<date datetime="${sevenDaysAgo}" when="before"/> 
					<type type="file"/>
				</and>
			</fileset>
		</delete>
		<delete includeemptydirs="true" verbose="false">
			<fileset dir="${release}" includes="**">
				<and>
					<date datetime="${sevenDaysAgo}" when="before"/> 
					<type type="dir"/>
				</and>
			</fileset>
		</delete>
 

Does anyone see a simpler solution?

Thanks 
-jacques

>You need 3 things:
>- delete task
>- fileset type
>- selector type
>
>There should be a selector for your needs. Follow the links in the manual to
>
>delete|fileset|selector.

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


Mime
View raw message