开发者

need to check if filename contains the date.default property in ant script

开发者 https://www.devze.com 2023-01-28 01:30 出处:网络
Here is my script: ` description=\"--> emails any file from a specified location\"> <tstamp>

Here is my script: `

        description="--> emails any file from a specified location">
    <tstamp>
        <format property="date.default" pattern="yyyy-MM-dd" 
                offset="-1" unit="day" />
    </tstamp>
    <echo message="${date.default}" />
    <for param="file">
        <path&开发者_如何学Gogt;
            <fileset dir="${report.dir}">
                <include name="**/*file*.doc" />
                    <contains text=" ${date.default}"/>                 
            </fileset>
        </path>
    </for>`


It looks like you're trying to iterate over the set of files with names that match both the word 'file' (as you use this in the include element) and the value of '${date.default}'. You probably don't need to use a selector for that - the include directive is usually enough for file name matches. For example, you might use:

<include name="**/*file*${date.default}*.doc" />

The contains selector is for matching content of files, rather than the file names. If you have a complex filename-based matching rule, then you may need to make use of the filename selector in combination with includes, and possibly excludes. But 'filename' selectors are normally only needed when selection is based on filename plus some other criteria.

0

精彩评论

暂无评论...
验证码 换一张
取 消