如何通过“get”任务递归下载文件?
我正在寻找相当于以下内容的 Ant:
wget -r -nH --cut-dirs=5 --level=0 ftp://ftp.some.host/dir1/dir2...../dir6
我在 build.xml 中有此代码片段:
<get src="${ftpPath}" dest="tempfolder" verbose="true" />
结果:
[get] Getting: <FTP_URL_HERE>
[get] To: <dir>/tempfolder
[get] ....
BUILD SUCCESSFUL
Total time: 0 seconds
没有下载任何内容。我假设“获取”任务仅适用于文件。不幸的是,无法列出 中的每个文件(可能有上千个文件)。标签。
我对通过“exec”任务运行 wget 命令有点犹豫,因为 Windows 本身没有 wget,而且我想以最小的努力保持平台独立性。
How can I recursively download files via the 'get' task?
I'm looking for the Ant equivalent of:
wget -r -nH --cut-dirs=5 --level=0 ftp://ftp.some.host/dir1/dir2...../dir6
I have this snippet in build.xml:
<get src="${ftpPath}" dest="tempfolder" verbose="true" />
Results in:
[get] Getting: <FTP_URL_HERE>
[get] To: <dir>/tempfolder
[get] ....
BUILD SUCCESSFUL
Total time: 0 seconds
Nothing gets downloaded. I'm assuming the 'get' task is only for files. Unfortunately, it's not an option to list every single file (this can go in the 1000s) within the <url> tags.
I'm a little hesitant running the wget command via the 'exec' task, since Windows doesn't natively have wget, and I want to maintain platform-independence with minimal effort.
发布评论
评论(1)
我不认为您可以嵌套文件集或以其他方式指定
@src
或
资源。但是,如果您的
${ftpPath}
是 FTP 路径,那么您可以使用
任务,它支持文件集和模式:I don't believe that you can nest a fileset or otherwise specify an include pattern for the
@src
or a<url>
resource.However, if your
${ftpPath}
is an FTP path, then you could use the<ftp>
task, which does support filesets and patterns: