Combine the date selector with the <tstamp> task. In <tstamp>, you can
specify the offset and a property. For example:
<tstamp>
<format pattern="MM/dd/yyyy hh:mm aa" offset="-10" property="delete.date"/>
</tstamp>
This will set the ${delete.date} to ten days before today in the
format the date selector likes.
Then, using the selector:
<delete>
<fileset dir="${some.dir}">
<date datetime="${delete.date}" when="before"/>
</fileset>
</delete>
And, all files in ${some.dir} older than 10 days get deleted.
On Feb 4, 2008 9:57 AM, Ramu Sethu <[EMAIL PROTECTED]> wrote:
> Thanks CHarbel
>
> But it looks we need to keep the date static ..My script runs daily... And i
> wanted to delete folders older than the specific date which varies daily (
> eg.current date).
> Only the reports for the last 10 days should be in my m/c
>
>
> On Feb 4, 2008 5:14 AM, Charbel BITAR <[EMAIL PROTECTED]> wrote:
>
> > Hi Ramu,
> >
> > Check http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
> >
> > HTH
> > --
> > Charbel
> >
> >
> >
> > On Feb 3, 2008 4:52 PM, Ramu Sethu <[EMAIL PROTECTED]> wrote:
> >
> > > Hi All
> > >
> > > I actually wanted to manage a set of folders. We create junit reports
> > > daily
> > > with the folder name Report<Date>. I want ant to delete the report
> > > folders
> > > which are older than 10 days. Is it possible to do with ant built in
> > tasks
> > > or Should i go for custom tasks?. I tried with the nested fileset of
> > > delete task, but i couldn't succeed as i was in need for date comparison
> > >
> > > Could anybody help me on this?
> > >
> > > --
> > > Thank you
> > > Ramu S
> > >
> >
>
>
>
> --
> Thank you
> Ramu S
>
> If A is success in life, then A equals x plus y plus z. Work is x; y is
> play; and z is keeping your mouth shut.
> - Albert Einstein
>
--
--
David Weintraub
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]