1

I'm using the following task to get a specific file from a URL and install it on my local DIR:

<project name="MobileBanking" basedir="../">
    <target name="get">
        <get src="https://domain/dsprdamf1/mf/node1/logs/server11_mf/trace.log" dest="Local/Logs" usetimestamp="true" username="${USERNAME}" password="${PASSWORD}"/>
    </target>
</project>

However, the problem is that I have multiple files that starts with word "trace" and I need to get them all to my local directory.

I've tried the following:

<get src="https://domain/dsprdamf1/mf/node1/logs/server11_mf/trace*" dest="Local/Logs" usetimestamp="true" username="${USERNAME}" password="${PASSWORD}"/>

and

<get src="https://domain/dsprdamf1/mf/node1/logs/server11_mf/*" dest="Local/Logs" usetimestamp="true" username="${USERNAME}" password="${PASSWORD}"/>

but none worked.

What should I use to get all the files that start with word "trace" from a URL?

M A
  • 71,713
  • 13
  • 134
  • 174
Sami
  • 572
  • 8
  • 22

1 Answers1

1

I don't think this is possible with URLs. The get task retrieves a file from any URL. In order to support pattern based forms of a URL input such as basePath/trace*.html, the task should query the URL basePath and parse the content HTML of the page to determine the list of HTML pages in this path, which is a thing tedious to do (if possible in the first place, see How to get list of files/directories of an directory url in java?). Try getting the content of the base URL, parse its result and see if you can get the list of all trace* files there (this may be a solution, but it is very ugly).

You can look at alternatives like the ftp or scp tasks which support nested fileset resources with include and exclude wildcard patterns. Unlike the get task, ftp works based on the FTP protocol which allows getting a list of files in a remote directory. However this requires services like the FTP server or SSH daemon to be available.

Community
  • 1
  • 1
M A
  • 71,713
  • 13
  • 134
  • 174
  • Thank you for your answer, I think you are right about this. I need to find another way to get all the nested files other than "get". Will check ftp or scp. – Sami Sep 08 '16 at 17:34