Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Java Program delete files in directory also include subdirectory (http://www.velocityreviews.com/forums/t146322-java-program-delete-files-in-directory-also-include-subdirectory.html)

moon 09-20-2005 08:14 AM

Java Program delete files in directory also include subdirectory
 
How to write a java program to delete files in directory also include
subdirectory since modified n days ago ?
like UNIX find command

find /tmp -name '*.prn' -mtime +30 -print -exec rm {}



Roedy Green 09-20-2005 09:46 AM

Re: Java Program delete files in directory also include subdirectory
 
On Tue, 20 Sep 2005 16:14:34 +0800, "moon" <moon_ils-se@yahoo.com.hk>
wrote or quoted :

>How to write a java program to delete files in directory also include
>subdirectory since modified n days ago ?
>like UNIX find command


File.list and File.isDirectory. You write recursive delete.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Abhijat Vatsyayan 09-20-2005 01:01 PM

Re: Java Program delete files in directory also include subdirectory
 
moon wrote:
> How to write a java program to delete files in directory also include
> subdirectory since modified n days ago ?
> like UNIX find command
>
> find /tmp -name '*.prn' -mtime +30 -print -exec rm {}
>
>


You might also want to look at the ant API. See class
org.apache.tools.ant.taskdefs.Delete .

Thomas Fritsch 09-20-2005 01:31 PM

Re: Java Program delete files in directory also include subdirectory
 
Roedy Green wrote:
>>How to write a java program to delete files in directory also include
>>subdirectory since modified n days ago ?
>>like UNIX find command

>
> File.list and File.isDirectory.

and File.lastModified and System.currentTimeMillis

> You write recursive delete.




All times are GMT. The time now is 07:31 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.