PDA

View Full Version : [SOLVED] wget to get ONLY images directory



smoh
October 29th, 2010, 07:54 PM
Hey All,

I'm an absolute ubuntu and linux noob all together. I just discovered the wget function which works perfectly for what I need to do. I'm trying to download my /images directory. I've tried to do wget -m mydomain.com/images but it ends up downloading everything from my domain which is not what I want at all.

If anyone can help with a wget function JUST to get all of the files from my /images directory, that would be great! I'm using ubuntu server version right now and have successfully set up dedicated server there.

gmargo
October 29th, 2010, 08:58 PM
Try adding the --no-parent option.

smoh
October 30th, 2010, 03:09 AM
Hi,

I tried wget -np mydomain.com/images and it saves a file but doesn't actually get the rest of the images directory that I want.

It saves a file as images with no specific file type. Here's what terminal spits out to me...


...........
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.mydomain.com/images/ [following]
--2010-10-29 22:03:23-- http://www.mydomain.com/images/
Connecting to www.mydomain.com|ipaddress|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `images'


Any ideas on how I can get this? What about the child folders as well? For example mydomain.com/images/folder1/subfolder1

smoh
October 30th, 2010, 03:13 AM
Quick update...

Adding the slash at the end of /images/ gives me an html file with the file names, but not the actual images itself. Any ideas on how I can download the entire directory?

gmargo
October 30th, 2010, 04:15 PM
Why did you remove the --mirror (-m) option?

joshruehlig
October 30th, 2010, 04:18 PM
/images/*.jpg /images/*.png (ect)
This will grab all jpg's and png's in you image directory

smoh
November 1st, 2010, 09:32 PM
/images/*.jpg /images/*.png (ect)
This will grab all jpg's and png's in you image directory

Thanks for your help ladies and gents. It still isn't working now. I'm getting a 404 Not Found error when I try to do something like wget -np http://www.mydomain.com/images/*.jpg



wget -m http://www.mydomain.com/images/*.jpg

Gives the same error as well. Any reason why this would be happening? This is so frustrating :(

smoh
November 1st, 2010, 09:37 PM
Just figured it out. It was a combination of what everyone said..

For anyone looking...

wget -m -np yourdomain.com/images/