• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • 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:
C:\Users\KingV\workspace\Project-Common

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:
C:\Users\KingV\workspace\Project-1
C:\Users\KingV\workspace\Project-2


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: 41933
910
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.

 
Good night. Drive safely. Here's a tiny ad for the road:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic