假设我有一个目录,其中包含多个具有相同名称前缀和时间戳的文件,例如
my-directory:
- file-0749
- file-1253
- file-2304
如何告诉 ANT 从我的目录中选择最新修改的文件(在本例中为 file-2304)?
最佳答案
您可以使用 TimestampSelector
来做到这一点。来自 ant-contrib 的任务.
<timestampselector property="latest.modified">
<path>
<fileset dir="${my-directory.dir}">
<include name="file-*" />
</fileset>
</path>
</timestampselector>
<echo message="${latest.modified}" />
关于Ant:如何从目录中选择最新修改的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5498710/