我有以下 XML 结构:
<servers>
<hostname>ABC01</hostname>
<hostname>ABC02</hostname>
</servers>
我需要从每个服务器、我知道的文件夹中检索文件,将其附加到电子邮件中,然后发送。
这样做的方法是什么?
谢谢。
我有以下 XML 结构:
<servers>
<hostname>ABC01</hostname>
<hostname>ABC02</hostname>
</servers>
我需要从每个服务器、我知道的文件夹中检索文件,将其附加到电子邮件中,然后发送。
这样做的方法是什么?
谢谢。
使用该xmlproperty
任务将 XML 文件加载到属性中。
然后使用 ant-contrib 中的任务对for
每个匹配的属性进行操作。
就像是:
<target name="funtimes">
<xmlproperty file="the.xml" delimiter=","/>
<for list="${servers.hostname}" param="hostname">
<sequential>
<echo>Doing things with @{hostname}</echo>
</sequential>
</for>
</target>
获取文件取决于您计划如何访问它们。这项scp
任务可能会有所帮助。
对于发送电子邮件,您可以使用mail
任务。