ant filter fileset

下面的脚本的意思是:

在 src.dir 目录下的所有文件中,如果有预先定义好的"@log4j.logger@"占位符的话,在拷贝到 dest.dir 目录后,所有的占位符都被替换成了"INFO"。

<project name="testBuild" default="compile" basedir="."> 
<property file="build.properties"/> 
<target name="compile"> 
	<filter token="log4j.logger" value="INFO"/> 
	<copy todir="${dest.dir}" filtering="true"> 
	<fileset dir="${src.dir}"/> 
	</copy> 
</target> 
</project>

dest.dir=c:/temp/dest/testProj
src.dir=c:/temp/src/testProj

源文件:

[email protected]@_1.txt
[email protected]@_1.txt
[email protected]@_1.txt
[email protected]@_1.txt
[email protected]@_1.txt
[email protected]@_1.txt
[email protected]@_1.txt
[email protected]@_1.txt
------------------------
Jin_log4j.logger_1.txt
Jin_log4j.logger_1.txt
Jin_log4j.logger_1.txt
Jin_log4j.logger_1.txt

修改后文件:

Jin_INFO_1.txt
Jin_INFO_1.txt
Jin_INFO_1.txt
Jin_INFO_1.txt
Jin_INFO_1.txt
Jin_INFO_1.txt
Jin_INFO_1.txt
Jin_INFO_1.txt
------------------------
Jin_log4j.logger_1.txt
Jin_log4j.logger_1.txt
Jin_log4j.logger_1.txt
Jin_log4j.logger_1.txt

你可能感兴趣的:(ant filter fileset)