Windows下用wget下载网页

Howto Download Your Website Using WGET for Windows

Windows下用wget下载网页

Writtenby: Richard Baxter

Ever had that terrifying feeling you’velost your blog? Perhaps your WordPress installation got hacked, or you’ve gotto move to a new web host because your old ones screwed up with a “databaseupgrade”. Either way there’s an almost infinite array of reasons to downloadand backup a copy of your website, and precisely zero reasons to neglect doingit.

你是否曾经有想过丢失博客那种可怕的感觉?也许你的WordPress的被黑过,或者你要搬到一个新的Web主机因为“数据库升级”。无论是哪种方式有一个几乎无限的理由来下载和备份您的网站的副本,而你没有任何理由忽视做它。

If you’re a Linux user, there are lots ofguides out there on how to use WGET, the free network utility to retrieve filesfrom the World Wide Web using HTTP and FTP, but no guides to doing so withWindows. Unless you fancy installing Ubuntu or Crunchbang, here’s a handy guideto downloading your site using WGET in Windows.

如果你是一个Linux用户,有很多教程教你如何使用wget,wget是用来从网页上获取文件免费的网络工具,但没有Windows平台下的相关教程。除非你想安装Ubuntu或crunchbang,这里有一个方便的指南,在Windows平台下使用wget下载您的网文件。

Summary: Here’s how to install and use WGETin Windows

摘要:如何在Windows下安装使用wget

Download WGET.

1.

Make WGET a command you can run from anydirectory in Command Prompt.

首先要让wget可以在任何目录下运行命令提示符。

Restart the command terminal and test WGET.

重启命令终端,测试wget

Make a directory to download your site to.

找一个目录下载你的网址

Use the commands listed in this article todownload your site.

使用本文中列出的命令来下载你的网站。

Down to the details – get started:

 

Download WGET

 

Download and save WGET to your desktop. Youcan get wget.exe here. I recommend downloading WGET for Windows (win32) fromUgent.be as it’s the most up to date version I could find. For info, you canalso get WGET from Brothersoft. Avoid the WGET for Windows(http://gnuwin32.sourceforge.net/packages/wget.htm) download page, because theirinstaller doesn’t work with Windows versions later than Vista!

下载wget并保存到您的桌面上。你可以在这里得到wget.exe。我推荐下载wget的Windows(Win32)版的wget,ugent.be是我能找到的最新版本。您也可以从Brothersoft下载wget。避免Windows wget(http://gnuwin32.sourceforge.net/packages/wget.htm)下载页面,因为安装程序不能与Windows版本比Vista!

Make WGET a command you can run from anydirectory in Command Prompt

让wget命令可以在任何目录下运行命令提示符。

If you want to be able to run WGET from anydirectory inside the command terminal, you’ll need to learn about the pathcommand to work out where to copy your new executable.

如果你希望命令终端能够在任何目录下运wget,你需要了解您的新的可执行文件应该放在哪。

First, open a command terminal by selecting“run” in the start menu (if you’re using Windows XP) and typing “cmd”. Ifyou’re running Windows Vista go to “All Programs > Accessories > CommandPrompt” from the start bar.

首先,打开命令终端选择“运行”,在“开始”菜单(如果你使用的是Windows XP),键入“cmd”。如果您运行的是Vista,操作如下:“所有程序>附件>命令提示”,

 你将看到下图:

terminal

 

We’re going to move wget.exe into a Windowsdirectory that will allow WGET to be run from anywhere. First, we need to findout which directory that should be. Type:

要想让wget.exe在任何路径下运行,需要将wget放在:C:Windows\System32或者 C:Windows.

 

into the command prompt to find out:

到命令提示处查找:

command prompt path command

命令提示符路径命令

Thanks to the “Path” environment variable,we know that we need to copy wget.exe to either the C:WindowsSystem32 directoryor the C:Windows directory.

 

Go ahead and copy WGET to either of thedirectories you see in your Command Terminal.

 

Restart the command terminal and test WGET

重启命令终端,测试wget.exe。

 

If you want to test WGET is workingproperly, restart your terminal and type:

 

wget -h

 

If you’ve copied the file to the rightplace, you’ll see a help file appear with all of the available commands

 

Make a directory to download your site to

 

Seeing that we’ll be working in CommandPrompt, let’s create a download directory just for WGET downloads. *If you’refamiliar with Command Terminal basics, just skip this step. Change to the C:and use to make a directory:

 

md

 

make directory

 

Change to your new directory and you’reready to do some downloading!

 

cd site-download

 

Use these commands to download your siteusing WGET

 

Ok, the fun bit begins. Once you’ve gotWGET installed and you’ve created a new directory, all you have to do is learnsome of the finer points of WGET arguments to make sure you get what you need.

 

I found two particularly useful resourcesfor WGET usage. The Gnu.org WGET Manual and About.com’s Linux WGET guide aredefinitely the best.

 

After some research I came up with a set ofinstructions to WGET to recursively mirror your site, download all the images,CSS and JavaScript, localise all of the URLS (so the site works on your localmachine), and save all the pages as a .html file.

 

To mirror your site execute this command:

 

wget -r http://www.yoursite.com

 

To mirror the site and localise all of theurls:

 

wget --convert-links -rhttp://www.yoursite.com

 

To mirror the site and save the files as.html:

 

wget --html-extension -rhttp://www.yoursite.com

 

Stop WGET from being blocked

 

Some web servers are set up to deny WGET’sdefault user agent – for obvious, bandwidth saving reasons. You could trychanging your user agent to get round this. Try er, pretending to be Googlebot:

 

wget --user-agent="Googlebot/2.1(+http://www.googlebot.com/bot.html)" -r http://www.yoursite.com

 

And finally, here’s WGET downloading mywebsite:

 

downloading seogadget

 

On that last note, lots of hostingcompanies block WGET. Mine included! Took me a while to be able to back my ownsite up but now, I feel pretty safe that I have backups of the database, theplugins, the images and even the HTML of the site itself.

 

Learn More

 

Builtvisible are a team of specialists wholove search, SEO and creating content marketing that communicates ideas andbuilds brands.

 

To learn more about how we can help you,take a look at the services we offer.

 

Stay Updated

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值