• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reg: deleting files on the basis of timestamp

 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>.
 
Max White
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic