如何使用 wget 下载整个目录和子目录?

新手上路,请多包涵

我正在尝试使用 wget 下载项目的文件,因为该项目的 SVN 服务器不再运行,我只能通过浏览器访问文件。所有文件的基本 URL 都相同

http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/ *

如何使用 wget (或任何其他类似工具)下载此存储库中的所有文件,其中“tzivi”文件夹是根文件夹,并且有多个文件和子文件夹(最多 2 个或3级)下呢?

原文由 code4fun 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.2k
2 个回答

您可以在 shell 中使用它:

 wget -r --no-parent http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/

参数是:

 -r     //recursive Download

--no-parent // Don´t download something from the parent directory

如果您不想下载全部内容,可以使用:

 -l1 just download the directory (tzivi in your case)

-l2 download the directory and all level 1 subfolders ('tzivi/something' but not 'tivizi/somthing/foo')

等等。如果您不插入 -l 选项,则 wget 将自动使用 -l 5

如果您插入 -l 0 您将下载整个 Internet,因为 wget 将跟随它找到的每个链接。

原文由 user2936450 发布,翻译遵循 CC BY-SA 3.0 许可协议

您可以在外壳中使用它:

 wget -r -nH --cut-dirs=7 --reject="index.html*" \
      http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/

参数是:

 -r recursively download

-nH (--no-host-directories) cuts out hostname

--cut-dirs=X (cuts out X directories)

原文由 Rajiv Yadav 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题