Re: getting filename from dir listing
Thanks Dale, This is really interesting and will read the documentation and see what else is available. Marijan (Mario) Madunic Dale Anson wrote: Another alternative is to use the FileUtils and StringUtils from Antelope, http://antelope.tigris.org. Here's an example:
Re: getting filename from dir listing
Another alternative is to use the FileUtils and StringUtils from Antelope, http://antelope.tigris.org. Here's an example: first 8 characters of file name = ${first_8} This will show the first 8 characters of the first file in Ant's lib directory
Re: getting filename from dir listing
Mario Madunic wrote: Thanks Gilbert. I ran a test of your script and received the following error. sorry was untested, use = str=File.basename(Dir["J:/test/*.xml"].sort[0]).gsub(/(\w{8}).+/, '\1')$project.setProperty "myproperty"
Re: getting filename from dir listing
Thanks Gilbert. I ran a test of your script and received the following error. C:\RBI\VAP>test C:\RBI\VAP>ant -f C:\RBI\VAP\antTasks\reports.xml Buildfile: C:\RBI\VAP\antTasks\reports.xml step01: [script] Sep 21, 2007 12:18:54 PM org.apache.bsf.BSFManager exec [script] SEVERE: Exception :
Re: getting filename from dir listing
Hi, Mario Madunic wrote: I would like to get the filename of the first file in a directory and then get a particular part of the filename. There has to be a much easier and cleaner way of doing this. You want the first part of the filename, right ? with a dir like that = J:\test>dir /B 2007
getting filename from dir listing
I would like to get the filename of the first file in a directory and then get a particular part of the filename. The files all basically follow this format: 20070921_0001.xml. Currently I'm using a combination of windows command line and ant. It looks like the following in a bat file (I know it c