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:
<fileutil file="${ant.library.dir}" property="file_list">
<listfiles includepath="false"/> <!-- just filenames, no paths -->
</fileutil>
<stringutil string="${file_list}" property="first_8">
<substring endindex="8"/> <!-- default start index is 0 -->
</stringutil>
<echo>first 8 characters of file name = ${first_8}</echo>
This will show the first 8 characters of the first file in Ant's lib
directory.
Dale
Gilbert Rebhan wrote:
Mario Madunic wrote:
Thanks Gilbert.
I ran a test of your script and received the following error.
sorry was untested, use =
<script language="ruby">
<![CDATA[
str=File.basename(Dir["J:/test/*.xml"].sort[0]).gsub(/(\w{8}).+/, '\1')
$project.setProperty "myproperty", str
]]>
</script>
means use '\1' instead of $1 in the gsub part
and it will work.
Regards. Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]