开发者

Download non web accessible file with wget

Is it possible to download a file in say /home/... using wget to my local machine? I'm pretty newbish on the bash shell side so perhaps this is just a matter of using the options correctly. What I've gleaned is that something like this should work, but my test aren't downloading the file locally but placeing them within the folder i'm using wget in

root@mysite [/home/username/public_html/themes/themename/images]# wget -O "tester.png" 

"http://www.mysite.com/themes/themename/images/previous.png"
--2011-09-08 14:28:49--  http://www.mysite.com/themes/themename/images/previous.png
Resolving www.mysite.com... 173.193.xxx.xxx
Connecting to www.mysite.com|173.193.xxx.xxx|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 352 [image/png]
Saving to: `tester.png'

100%[==============================================================================================>] 352         --.-K/s   in 0s      

2011-09-08 14:28:49 (84开发者_开发技巧.3 MB/s) - `tester.png' saved [352/352]

Perhaps the above is a bad example but I can't seem how to figure out how to use wget (or some other command) to get something from a non web accessable directory (its a backup file) is wget the correct command for this?


wget uses the http (or ftp) protocol to transfer it's files, so no, you can't use it to transfer anything which is not availible through those services. What you should do is use scp. It uses ssh, and you can use it to get any file (which you have the permission to read, that is).

Say you want /home/myuser/test.file from the computer mycomp, and you want to save it as test.newext. Then you'd invoke it like this:

scp myuser@mycomp:/home/myuser/test.file test.newext

You can do a lot of other nifty stuff with scp so read the manual for more possibilities!


This belongs on superuser, but you want to use scp to copy the file to your local machine.

When a file isn't web accessible, you cant' get it with wget.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜