Ant get file creation timestamp

前端 未结 4 1428
自闭症患者
自闭症患者 2020-12-11 11:15

I am writing a manifest.xml file during an Ant build for an OpenCMS project.

I need to be able to pull up a file\'s create date, and last modified date

4条回答
  •  攒了一身酷
    2020-12-11 12:00

    Problem is the standard Java File object only supports a method for returning the last modified date:

    • How to discover a File's creation time with Java?
    • Determine file creation date in Java

    The problem is addressed in Java 7, using the new NIO classes:

    • http://docs.oracle.com/javase/tutorial/essential/io/fileAttr.html

    Obviously to take advantage of this in ANT you'd need to write a custom task or embed a script.

提交回复
热议问题