是否可以在say/home/中下载文件…在我的本地机器上使用wget?我在bash shell方面很新手,所以也许这只是正确使用选项的问题。我收集到的是这样的东西应该可以工作,但是我的测试不是在本地下载文件,而是将它们放在我使用wget的文件夹中
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]
也许上面的例子不好,但我似乎不知道如何使用wget(或其他一些命令)从一个不可web访问的目录(它是一个备份文件)中获取某些内容wget是正确的命令吗?
最佳答案
wget
使用http(或ftp)协议传输它的文件,因此不,您不能使用它传输那些服务不可用的任何内容。你应该做的是使用scp
。它使用ssh,您可以使用它来获取任何文件(即您有权读取的文件)。
假设您想要从计算机/home/myuser/test.file
获取mycomp
,并将其另存为test.newext
。然后你可以这样调用它:
scp myuser@mycomp:/home/myuser/test.file test.newext
你可以用
scp
做很多其他漂亮的事情,所以阅读手册了解更多的可能性!