Recursively Download Files Using wget

If you want to download multiple files recursively from a website wget is the way to go. The popular alternative tool curl does not support recursive download.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# Download all files having extension jar, xml but not exe from the given path looking at one level (immediate children only)
wget -r -np -l 1 -A jar,xml -R exe http://target-website.com/path/
# Interpretation of the options
-r Recursive downaload
-np Do not ascend to the parent directory
-l Recursion depth (0 for infinite)
-A Accepted file extensions
# Download all files having extension jar, xml but not exe from the given path looking at one level (immediate children only) wget -r -np -l 1 -A jar,xml -R exe http://target-website.com/path/ # Interpretation of the options -r Recursive downaload -np Do not ascend to the parent directory -l Recursion depth (0 for infinite) -A Accepted file extensions
# Download all files having extension jar, xml but not exe from the given path looking at one level (immediate children only)
wget -r -np -l 1 -A jar,xml -R exe http://target-website.com/path/

# Interpretation of the options
-r    Recursive downaload
-np   Do not ascend to the parent directory
-l    Recursion depth (0 for infinite)
-A    Accepted file extensions

Note that, links constructed dynamically using Javascript or any other way, won’t be visible to wget.



If wget is not installed already, use the below commands:



Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# Windows
choco install wget
# Mac
brew install wget
# Windows choco install wget # Mac brew install wget
# Windows
choco install wget

# Mac
brew install wget
Recursively Download Files Using wget
Be The First

Join our list to get instant access to new articles and weekly newsletter.

Tagged on:     
0 0 votes
Article Rating
Subscribe
Notify of
guest


0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x