cod*_*fun 135 regex linux bash wget
我正在尝试下载项目的文件,因为该项目wget的SVN服务器不再运行,我只能通过浏览器访问文件.所有文件的基本URL都是相同的
http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/*
如何使用wget(或任何其他类似工具)下载此存储库中的所有文件,其中"tzivi"文件夹是根文件夹,并且下面有多个文件和子文件夹(最多2或3级)?
sn0*_*n0w 181
你可以在shell中使用它:
wget -r --no-parent http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/
Run Code Online (Sandbox Code Playgroud)
参数是:
-r //recursive Download
Run Code Online (Sandbox Code Playgroud)
和
--no-parent // Don´t download something from the parent directory
Run Code Online (Sandbox Code Playgroud)
如果您不想下载整个内容,可以使用:
-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')
Run Code Online (Sandbox Code Playgroud)
等等.如果您不插入任何-l选项,wget将-l 5自动使用.
如果您插入一个将-l 0下载整个Internet,因为wget它将跟随它找到的每个链接.
小智 13
你可以在shell中使用它:
wget -r -nH --cut-dirs=7 --reject="index.html*" \
http://abc.tamu.edu/projects/tzivi/repository/revisions/2/raw/tzivi/
Run Code Online (Sandbox Code Playgroud)
参数是:
-r recursively download
-nH (--no-host-directories) cuts out hostname
--cut-dirs=X (cuts out X directories)
Run Code Online (Sandbox Code Playgroud)
小智 6
这个链接给了我最好的答案:
$ wget --no-clobber --convert-links --random-wait -r -p --level 1 -E -e robots=off -U mozilla http://base.site/dir/
Run Code Online (Sandbox Code Playgroud)
像魅力一样工作。
小智 5
wget -r --no-parent URL --user=username --password=password
Run Code Online (Sandbox Code Playgroud)
如果您有下载的用户名和密码,则最后两个选项是可选的,否则无需使用它们。
您还可以在链接中查看更多选项https://www.howtogeek.com/281663/how-to-use-wget-the-ultimate-command-line-downloading-tool/