🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# G.5 Different The `<different>` selector will select a file if it is deemed to be 'different' from an equivalent file in another location. The rules for determining difference between the two files are as follows: - If a file is only present in the resource collection you apply the selector to but not in targetdir (or after applying the mapper) the file is selected. - If a file is only present in targetdir (or after applying the mapper) it is ignored. - Files with different lengths are different. - If ignoreFileTimes is turned off, then differing file timestamps will cause files to be regarded as different. - Unless ignoreContents is set to true, a byte-for-byte check is run against the two files. This is a useful selector to work with programs and tasks that don't handle dependency checking properly; even if a predecessor task always creates its output files, followup tasks can be driven off copies made with a different selector, so their dependencies are driven on the absolute state of the files, not just a timestamp. For example: anything fetched from a web site, or the output of some program. To reduce the amount of checking, when using this task inside a <copy> task, set preservelastmodified to true to propagate the timestamp from the source file to the destination file. The <different> selector supports the use of a contained <mapper> element to define the location of the file to be compared against. If no <mapper> element is specified, the identity type mapper is used. ``` <fileset dir="${phing.1.5}/classes" includes="**/*.php"> <different targetdir="${phing.1.4.1}/classes" ignoreFileTimes="true"/> </fileset> ``` Table G.5:聽 Attributes for the `<different>` selector NameDescriptionDefaultRequired`targetdir`The base directory to look for the files to compare against. The precise location depends on a combination of this attribute and the `mapper` element, if any.n/aYes`ignoreFileTimes`Whether to use file times in the comparison or not.trueNo`ignoreContents`Whether to do a byte per byte compare.falseNo