Linux 如何使用 wget 下载整个目录和子目录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17282915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to download an entire directory and subdirectories using wget?
提问by code4fun
I am trying to download the files for a project using wget
, as the SVN server for that project isn't running anymore and I am only able to access the files through a browser. The base URLs for all the files is the same like
我正在尝试使用 下载项目的文件,因为该项目wget
的 SVN 服务器不再运行,我只能通过浏览器访问这些文件。所有文件的基本 URL 都是一样的
http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/*
http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/*
How can I use wget
(or any other similar tool) to download all the files in this repository, where the "tzivi" folder is the root folder and there are several files and sub-folders (upto 2 or 3 levels) under it?
我如何使用wget
(或任何其他类似工具)下载此存储库中的所有文件,其中“tzivi”文件夹是根文件夹,其下有多个文件和子文件夹(最多 2 或 3 级)?
采纳答案by code4fun
You may use this in shell:
你可以在 shell 中使用它:
wget -r --no-parent http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/
The Parameters are:
参数是:
-r //recursive Download
and
和
--no-parent // Don′t download something from the parent directory
If you don't want to download the entire content, you may use:
如果您不想下载整个内容,可以使用:
-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')
And so on. If you insert no -l
option, wget
will use -l 5
automatically.
等等。如果没有插入-l
选项,wget
将-l 5
自动使用。
If you insert a -l 0
you′ll download the whole Internet, because wget
will follow every link it finds.
如果你插入一个-l 0
你会下载整个互联网,因为wget
会跟随它找到的每个链接。
回答by Rajiv Yadav
You can use this in a shell:
您可以在 shell 中使用它:
wget -r -nH --cut-dirs=7 --reject="index.html*" \
http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/
The Parameters are:
参数是:
-r recursively download
-nH (--no-host-directories) cuts out hostname
--cut-dirs=X (cuts out X directories)
回答by lanni654321
use the command
使用命令
wget -m www.ilanni.com/nexus/content/
回答by baobab33
you can also use this command :
你也可以使用这个命令:
wget --mirror -pc --convert-links -P ./your-local-dir/ http://www.your-website.com
so that you get the exact mirror of the website you want to download
以便您获得要下载的网站的确切镜像
回答by Hiep Luong
This works:
这有效:
wget -m -np -c --no-check-certificate -R "index.html*" "https://the-eye.eu/public/AudioBooks/Edgar%20Allan%20Poe%20-%2"
回答by Sarkar_lat_2016
wget -r --no-parent URL --user=username --password=password
the last two options are optional if you have the username and password for downloading, otherwise no need to use them.
如果您有下载的用户名和密码,则最后两个选项是可选的,否则无需使用它们。
You can also see more options in the link https://www.howtogeek.com/281663/how-to-use-wget-the-ultimate-command-line-downloading-tool/
您还可以在链接https://www.howtogeek.com/281663/how-to-use-wget-the-ultimate-command-line-downloading-tool/ 中看到更多选项