UNIX question regarding wget

Discussion in 'Mac Programming' started by Let's Sekuhara!, Jun 5, 2012.

  1. macrumors 6502

    Let's Sekuhara!

    Joined:
    Jun 30, 2008
    Location:
    日本
    #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
     
  2. macrumors regular

    Joined:
    Jun 8, 2010
    Location:
    Athens, Greece
    #2
    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.
     
  3. macrumors G4

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #3
    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.
     
  4. macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #4
    Or install Homebrew - http://mxcl.github.com/homebrew/

    And then just type 'brew install wget'
     
  5. macrumors G4

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #5
    I think MacPorts may have a wget available too - I've never used it before, though, so I don't know how it works.
     
  6. macrumors 68040

    Joined:
    Feb 2, 2008
    #6
    They sure do. 'port install wget'
     

Share This Page