aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Reg: deleting files on the basis of timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Reg: deleting files on the basis of timestamp" Watch "Reg: deleting files on the basis of timestamp" New topic
Author

Reg: deleting files on the basis of timestamp

Max White
Ranch Hand

Joined: Jun 28, 2008
Posts: 85
Hi,
I am using an Ant scrip to delete files on the basis of timestamp using the <date> selector.


The above code is just a part of the ant script.<date> is used within <delete>
Now when I am setting the "when" property to before or after in the properties file,its working as expected.
But not when I am setting it to "equal" .
What is wrong in my code.
Thanks.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

I suspect that when you use "equals" that both the date and the time have to match.

P.S. It would have helped if you had posted the <delete>.


JBoss In Action
Max White
Ranch Hand

Joined: Jun 28, 2008
Posts: 85
Code is pasted below



All the required properties are defined & delete is the default target.


I suspect that when you use "equals" that both the date and the time have to match.


But I am specifying the unit,in the init target , as "day".

Thanks.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

The "day" modifier only indicates that the property ${time} will be accurate to the day. However, when using ${time} in the <date> condition of the fileset, only those files modified on midnight of that date are considered.

If you want to delete all files created today, I would use 'when="after"' - that will catch anything created after midnight on ${time}.

(Caveat: The above are all guesses - I'd have to look at the source code to determine the exact behavior.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reg: deleting files on the basis of timestamp