的情况如下:我们如何使用ant脚本来提取文件的文件扩展名?
Therea三个文件:
TEST.XLS 的test.txt Test.doc的
我与mqfte现在的工作。当这些文件被转移到另一个位置的文件名必须是如下:
result_xls.txt result_txt.txt result_doc.txt
任何人都可以在这方面的帮助?
这个文件名重命名可以用ant脚本完成吗?
的情况如下:我们如何使用ant脚本来提取文件的文件扩展名?
Therea三个文件:
TEST.XLS 的test.txt Test.doc的
我与mqfte现在的工作。当这些文件被转移到另一个位置的文件名必须是如下:
result_xls.txt result_txt.txt result_doc.txt
任何人都可以在这方面的帮助?
这个文件名重命名可以用ant脚本完成吗?
试试这个:
<target name="test">
<copy todir="dest">
<fileset dir="src">
<include name="test*"/>
</fileset>
<globmapper from="test.*" to="result_*.txt"/>
</copy>
</target>
输入:
$ find src
src
src/test.doc
src/test.txt
src/test.xls
出把:
$ find dest/
dest/
dest/result_doc.txt
dest/result_txt.txt
dest/result_xls.txt
当然,你可以使用移动Ant任务http://ant.apache.org/manual/Tasks/move.html
谢谢sudocode !!!!! – trilawney 2011-05-26 12:51:30
你能为下面的问题提出建议吗?http://stackoverflow.com/questions/5870083/to-display-a-read-error-when-the-source-file-is-used-by-other-applications-while – trilawney 2011-05-26 13:03:35
当我在与filecopy任务相同的目标中的filecopy任务之后使用以下代码时,它不起作用。请注意,文件拷贝中的结果属性是推迟的。是由于结果=推迟的问题。 – trilawney 2011-05-30 13:28:56