Linux recursively download files
2021-07-20 本文已影响0人
JaedenKil
I want to download all pdf files recursively from link "http://xx.yy.zz.ww/home/Documents/":
wget --restrict-file-names=nocontrol -r -np -nH --cut-dirs=1 --accept pdf http://xx.yy.zz.ww/home/Documents/
Never miss the slash /
after the "Documents".
Explamation:
- Will download all files and subfolders in folder Documents directory
-
-r
: recursively -
np
: not going to upper directories, such ashome
-
nH
: not saving files to hostname folder -
--cut-dirs=1
: saving all contents to folderDocuments
but omitting the one ancestor folderhome
-
-R "*index.html*"
: not used in this command, but typically useful, excluding all files match the pattern -
--reject jpg,png
: Same to-R
-
--accept pdf
: Only download pdf files(the folders containing these files will not be abandoned)