Re: Delete old files task

"Wilson, Brian" <[email protected]> Thu, 6 Sep 2012 08:09:51 -0500
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Hey,

I think you would need to use the <script> task. You can write the script t=
o all the files in the directory, sort them by create date, and loop throug=
h them starting with the 4th item. Then check to see if the create date is =
1 month or less from the current date. If it is 1 month or less, then skip =
it, else, delete it.



Brian Wilson



-----Original Message-----
From: Ale=B9 Voj=E1=E8ek [mailto:[email protected]] =

Sent: Thursday, September 06, 2012 5:29 AM
To: [email protected]
Subject: [NAnt-users] Delete old files task

Hi all,
Is it possible to use some nant task to do this:
I need delete files with specific name NameOfFile*.zip which are older then=
 1 month and in dir must be at least 3 files of that name.
My english is not so good so here is example.

1. I have 30 files of specific name pattern. 25 are older then one month
- that 25 file will be deleted, because there still will be 5 files 2. I ha=
ve 30 files of specific name pattern. 29 are older then one month
- 27 oldest files will be deleted, because I need at least 3 files of that =
pattern.

Hopefully you can understand me

Best Regards Ales

---------------------------------------------------------------------------=
---
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat la=
ndscape has changed and how IT managers can respond. Discussions will inclu=
de endpoint security, mobile security and the latest in malware threats. ht=
tp://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users

---------------------------------------------------------------------------=
---
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and =

threat landscape has changed and how IT managers can respond. Discussions =

will include endpoint security, mobile security and the latest in malware =

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/