美文网首页
ant剪切、重命名、修改文件访问时间

ant剪切、重命名、修改文件访问时间

作者: 青玉_f18c | 来源:发表于2018-04-24 14:17 被阅读0次
    <?xml version="1.0" encoding="UTF-8"?>
    <project name ="test" default="all" basedir=".">
    <target name ="all">
    
    <!-- 剪切文件(含过滤条件)-->
    <move todir="other">
    <fileset dir="bin">
    <include name="**/*.jar"/>
    <exclude name="**/test.jar"/>
    </fileset>
    </move>
    
    <!--重命名文件(已过时)-->
    <rename src="bin/test.jar" dest="bin/my.jar"/>
    
    <!-- 建立临时文件-->
    <tempfile property="temp.file" destDir="bin" suffix=".xml"/>
    
    
    <!--如果文件不存在就创建,如果存在就修改最后访问时间为当前系统时间-->
    <touch file="myfile.txt"/>
    
    <!--如果文件不存在就创建,如果存在就修改最后访问时间为指定时间-->
    <touch file="myfile" datetime="05/23/2014 11:38 am"/>
    
    <!-- 更改目录下所有文件最后访问时间为下面指定时间-->
    <touch datetime="05/23/2014 11:38 am">
    <fileset dir="bin" />
    </touch>
    </target>
    </project>
    
    
    

    相关文章

      网友评论

          本文标题:ant剪切、重命名、修改文件访问时间

          本文链接:https://www.haomeiwen.com/subject/ickjlftx.html