为什么我不能使用&lt;日期和GT;选择一只蚂蚁&LT; dirset&GT ;? [英] Why can't I use <date> selector on an ant <dirset>?
问题描述
我有三个文件和目录三个目录,具有不同的日期。
I have three files and three directories in a directory, with varying dates.
$ cd mydir
$ ls -ltr
-rw-rw-r-- 1 skiphoppy users 0 Nov 14 00:00 file.old.20121114
drwxrwxrwx 2 skiphoppy users 4096 Nov 14 00:00 dir.old.20121114
drwxrwxrwx 2 skiphoppy users 4096 Dec 5 12:05 dir.old.20121205
drwxrwxrwx 2 skiphoppy users 4096 Dec 5 12:05 dir
-rw-rw-r-- 1 skiphoppy users 0 Dec 5 12:16 file.old.20121205
-rw-rw-r-- 1 skiphoppy users 0 Dec 5 12:16 file
我想建立一个dirset,其中包括超过2012年12月1日之前的所有目录。如果我读右,选择器可以被用于限制返回的文件。但现在看来,这并没有为dirset工作,即使dirset文档说,你可以使用嵌套patternsets和选择。
I want to build a dirset that includes all directories older than 2012-12-01. If I am reading right, the selector can be used to limit the files returned. But it appears this doesn't work for a dirset, even though the dirset documentation says you can use nested patternsets and selectors.
如果我使用日期选择一个文件集,我得到只是一个旧的文件,我所期望的;但对一个dirset相同的语法,我得到的所有目录:
If I use the date selector on a fileset, I get just the one old file that I would expect; but with the same syntax on a dirset, I get all directories:
<fileset id="old.files" dir="mydir">
<date datetime="12/01/2012 12:00 AM" when="before"/>
</fileset>
<echo message="Files: ${toString:old.files}"/>
<dirset id="old.dirs" dir="mydir">
<date datetime="12/01/2012 12:00 AM" when="before"/>
</dirset>
<echo message="Dirs: ${toString:old.dirs}"/>
输出:
[echo] Files: file.old.20121114
[echo] Dirs: ;dir;dir.old.20121114;dir.old.20121205
这是怎么回事这里说的日期选择器不起作用?
What is going on here that the date selector does not work?
推荐答案
您可能需要在 checkdirs
属性设置为日期选择。默认为假,即选择一切。
You probably need the checkdirs
attribute set for the date selector. The default is 'false', i.e. select everything.
<date datetime="12/01/2012 12:00 AM" when="before" checkdirs="true" />
这篇关于为什么我不能使用&lt;日期和GT;选择一只蚂蚁&LT; dirset&GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!