Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

ANT - Deleting directories - what am I doing wrong?

Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But, I must clearly be doing something wrong.

I have the following snippet from my build.xml:

This build.xml exists in:

which is an Eclipse project, and thus in Eclipse the project name is Project-Common.

The other projects are, obviously, Project-1, and Project-2, and exist in:

Now, the snippet I have works, but I'm trying to figure out how to get a single line to delete all directories inside a project's directory, but NOT files that are directly inside the project directory - and I'd also like to exclude the .settings directory from being deleted.

I've tried a few variants, but they're either too aggressive (delete everything, including the files, the .settings directory, the .project file, etc), or even delete the Project-1 and Project-2 folders themselves as well... or they delete the contents of the subdirectories, but leave the directories intact - ie Project-1/bin still exists, but everything below it is gone, etc.

So . . uh, how do I do this? I get the feeling I'm missing something incredibly simple here...

Thanks in advance.
author & internet detective
Posts: 41944
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code does what you describe. It's a lot longer, but more generic. I can't think of a shorter way to do it.

Is this the real life? Is this just fantasy? Is this a tiny ad?
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic