groovy AntBuilder样式选择已排序的文件:
def ant = new AntBuilder();
def files = ant.first(count:1){
sort(){
fileset(dir:/R:\goagent2/){
depth max:0
}
// reverse(){ date(); }
date()
}
}*.file;
答案 0 :(得分:1)
为什么不用普通的Groovy来做呢?
def oldestFile = new File( /R:\goagent2/ ).listFiles()
.sort { it.lastModified() }
.head()