I am using an Ant script to get the contents of a directory by means of the following:
<ac:foreach target="process-test" param="the_file" delimiter=",">
<path>
<fileset dir="${test.suite.url}">
<include name="**/*.html"/>
<exclude name="**/cases/"/>
</fileset>
</path>
</ac:foreach>
This is returning the full path to the file (which is something I also need) but, is it possible to strip away the path and give me just the filename?
To extract filename from the file, we use “GetFileName()” method of “Path” class. This method is used to get the file name and extension of the specified path string. The returned value is null if the file path is null.
path. split() method in Python is used to Split the path name into a pair head and tail.
In Excel, there is no direct function to get the name of the file, but you can use the CELL function to get the path of the file, and then we can use the MID function to extract the file name from it.
Isn't the Ant <basename>
task the thing you are looking for?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With