How to get file name from directory name in Ant?

I have a DirSet that I would like to convert to a comma-separated list of directory names. I'm not interested in the full path, just the names. Using ant -contrib "for the task, I was able to iterate the directories and create a target list, but for life I can’t understand how to extract only the directory name from the full path.

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

+3
source share
2 answers

I think you are looking for the Dirname Task .

+4
source

I would use the regex property from ant -contrib:

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

.

0

Source: https://habr.com/ru/post/1712981/


All Articles