Copy newest file with filename filter in Ant

后端 未结 1 1257
旧巷少年郎
旧巷少年郎 2020-12-11 10:00

I\'m trying to copy the newest file from a directory using Ant, ideally I\'d like to have a filter on the filename too (eg: \'*file.java\'), but I don\'t have any idea of ho

相关标签:
1条回答
  • 2020-12-11 10:45

    Answer was:

    <target name="init">
         <copy todir="." flatten="true">
            <last>
                <sort>
                    <date xmlns="antlib:org.apache.tools.ant.types.resources.comparators"/>
                    <resources>
                        <fileset dir="/path/to/files/">
                            <include name="*sdk*" />
                        </fileset>
                    </resources>
                </sort>
            </last>
        </copy>
    </target>
    

    edit: changed first to last and added filter

    0 讨论(0)
提交回复
热议问题