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 foreach - relative path directory listings Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "foreach - relative path directory listings" Watch "foreach - relative path directory listings" New topic
Author

foreach - relative path directory listings

David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122

basedir value: C:\Projects\
src.dir value: src
dirset looks in: basedir + src.dir == C:\Projects\src

Subdirectories in src:
package1
package2
package3

Resulting output:
C:\Projects\src\package1
C:\Projects\src\package2
C:\Projects\src\package3

Does anyone know how I can get a relative directory listing such that the output would be:
package1
package2
package3
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
If you might be wondering why I need just the directory names and not the entire path, it's because I'm using the directory names by themselves as property values.
I want the property value to be "package1" and not "C:\Projects\src\package1"
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
Here's the solution:
http://www.jguru.com/faq/view.jsp?EID=1019053
http://ant.apache.org/manual/CoreTasks/basename.html

Resulting output:
C:\Projects\src\package1
package1
C:\Projects\src\package2
package2
C:\Projects\src\package3
package3
 
 
subject: foreach - relative path directory listings
 
Threads others viewed
First Ant project not compiling
Understanding build.xml
build.xml question
using javadoc
Build failed- ejb3.deployer not found
jQuery in Action, 2nd edition