4

I want to use wget to download a whole image directory(something like mystie.com/images/) from one server to another. But when I go

wget --no-parent --recursive http://mysite.com/images/

I am always getting a generated index.html file instead of the directory. I know I probably need to do something on the source server to allow wget to retrieve the contents in it, but I don't know how not even what keywords to search. Thank you for your help.

Both server are running under ubuntu 16.04 and I have root access.

  • Here is a related topic that could give you some ideas: How do I create a CLI Web Spider that uses keywords and filters content? – pa4080 Jun 26 '19 at 14:42
  • 1
    With wget you have two possibilities: you can mirror the site over http, as you do, but then you will only get the images that are linked to on the website; or you can do wget over FTP by specifying an FTP username and password. In the latter case, wget can retrieve a listing of the items in the directory and download them all. – Jos Jun 26 '19 at 14:48
1

wget can download only what is served by the web-server. If you have a blank index.html in the directory, then wget can only download that file.

An alternative method would be to use sftp like this:

  1. sftp username@server_ip
  2. Enter your password
  3. get -r /var/www/html/images/
  4. exit
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.