• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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: 42173
937
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.

 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic