Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

wget: save as specific file

I want to download a webpage and save it as "/my/dir/hello.html"

If the file already exists, I want it to be overwritten.  This does NOT work:
wget http://example.com/page.html >hello.html

Open in new window

0
hankknight
Asked:
hankknight
  • 4
  • 3
1 Solution
 
farzanjCommented:
Try

wget -r http://example.com/page.html


If you want to set your destination directory, use -P option.
0
 
hankknightAuthor Commented:
Neither of those ideas work for me.

  -o  does NOT output the file contents
  -P  lets me set the directory but not change the file name.

I want to download a webpage and save it as "/my/dir/hello.html"
0
 
farzanjCommented:
It is upper case O not o

So you need


wget -O http://example.com/page.html > /my/dir/hello.html

Open in new window

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
hankknightAuthor Commented:
That gives me an error:
wget: missing URL Usage: wget [OPTION]... [URL]... Try `wget --help' for more options.
0
 
farzanjCommented:
Well, I tried and it worked for me.  I tried this

 wget -O http://www.cic.gc.ca/english/pdf/kits/forms/imm0008egen.pdf > imm.pdf

I did not have a good example but it works for me.

Can you show an example for WWW that doesn't work.
0
 
farzanjCommented:
May be your URL is invalid.  Try some other site
0
 
hankknightAuthor Commented:
Thanks.  Here is the code that I got working for me:
wget --output-document /my/dir/page.html http://example.com/ -o /dev/null

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now