Skip to content

Instantly share code, notes, and snippets.

@ThinkZ
Created April 15, 2017 16:35
Show Gist options
  • Select an option

  • Save ThinkZ/76bcb1055c3346a9f07a6a515d1615a8 to your computer and use it in GitHub Desktop.

Select an option

Save ThinkZ/76bcb1055c3346a9f07a6a515d1615a8 to your computer and use it in GitHub Desktop.
wget
使用 wget 下载一个目录下的所有文件
谁能看出标题配的图有什么问题?好吧,标题的图和本文没有任何关系!
今天想下载 MIT 的李代数课程笔记,参见网页:http://math.mit.edu/classes/18.745/Notes/. 突然间忘了 wget 的用法,如果直接将上述 URL 作为 wget 的参数的话,只会下载 index.html 文件。上网搜了一下,发现需要用到以下参数,所以写此日志记录之. 我参考了以下网站 http://bmwieczorek.wordpress.com/2008/10/01/wget-recursively-download-all-files-from-certain-directory-listed-by-apache/
基本上,只要:
wget -r -np -nH -R index.html http://url/including/files/you/want/to/download/
解释一下各个参数的含义:
-r : 遍历所有子目录
-np : 不到上一层子目录去
-nH : 不要将文件保存到主机名文件夹
-R index.html : 不下载 index.html 文件
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment