tags:

views:

430

answers:

2

I have a DirSet which I would like to convert to a comma-delimited list of directory names. I'm not interested in the full path, just the names. Using the ant-contrib "for" task I've been able to iterate the directories and create the target list, but for the life of me I can't figure out how to extract just the directory name from the full path.

Is there an Ant task that helps with concatenating/extracting path parts (like File in Java, or System.IO.Path in .NET)?

+2  A: 

I think you are looking for the Dirname task.

Otto Allmendinger
So I did, and somehow managed to miss it (weird!) Thanks!
Tomer Gabel
A: 

I would use propertyregex from ant-contrib:

http://ant-contrib.sourceforge.net/tasks/tasks/propertyregex.html

Regards.

mrrtnn
Seems a bit complicated for something this simple. See the answer above for a much simpler method.
Tomer Gabel
Yes, it's true. BTW, the link is broken. It should point to http://ant.apache.org/manual/Tasks/dirname.html
mrrtnn