Tomer Gabel
Tomer Gabel

Reputation: 4112

How do I obtain the file name from a directory name in Ant?

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)?

Upvotes: 3

Views: 1841

Answers (2)

Otto Allmendinger
Otto Allmendinger

Reputation: 28268

I think you are looking for the Dirname task.

Upvotes: 4

Martín Schonaker
Martín Schonaker

Reputation: 7305

I would use propertyregex from ant-contrib:

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

Regards.

Upvotes: 0

Related Questions