File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant task to delete directory contents 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 "Ant task to delete directory contents" Watch "Ant task to delete directory contents" New topic
Author

Ant task to delete directory contents

Dan Howard
Ranch Hand

Joined: Feb 22, 2004
Posts: 47
Hi All,

I normally use an ant task to delete a directory like this:

<delete dir="${some.dir}"/>

But what I really need is a task to delete all the files and folders in a directory but not the directory itself.

Is there such an animal?

TIA
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

From Ant's docs



deletes all files and subdirectories of build, without build itself.


GenRocket - Experts at Building Test Data
 
 
subject: Ant task to delete directory contents