Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Let's Sekuhara!

macrumors 6502
Original poster
Jun 30, 2008
357
1
日本
Hi, how can I use wget to download all of the contents of a folder on a web server to my Mac?

I've found this bit of code for doing this, but it's not clear where on my machine the files will be saved to if I run the script.

Code:
wget -r -A jpeg,jpg,bmp,gif,png http://www.domain.com
 
Hi, how can I use wget to download all of the contents of a folder on a web server to my Mac?

I've found this bit of code for doing this, but it's not clear where on my machine the files will be saved to if I run the script.

Code:
wget -r -A jpeg,jpg,bmp,gif,png http://www.domain.com

Although not in a Mac at the moment, it will save them at the current directory, where you type the command from. If you type it right after opening console, that directory will be your home (/~). To be sure type
Code:
pwd
(print working directory) before wget.
 
It's also worth noting that OS X does NOT come with wget. You'll need to install Xcode, download the Command-Line Tools if need be from within Xcode (this only needs to be done for Xcode 4.3 and later), then download/compile wget.

wget is really easy to build yourself, once the prerequisites are satisfied.
A simple:
Code:
cd /path/to/wget-VERSION
./configure
make
sudo make install
... will do the trick. Note that it installs to /usr/local/bin by default, a location that is NOT in the default PATH.
 
It's also worth noting that OS X does NOT come with wget. You'll need to install Xcode, download the Command-Line Tools if need be from within Xcode (this only needs to be done for Xcode 4.3 and later), then download/compile wget.

wget is really easy to build yourself, once the prerequisites are satisfied.
A simple:
Code:
cd /path/to/wget-VERSION
./configure
make
sudo make install
... will do the trick. Note that it installs to /usr/local/bin by default, a location that is NOT in the default PATH.

Or install Homebrew - http://mxcl.github.com/homebrew/

And then just type 'brew install wget'
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.