wget: can't open files
Asked Answered
R

3

5

I have configured apache2 and its working fine- when access http://localhost/ from the browser I am getting the correct response to the browser.

But, when i telnet to one of the client from this server and tried wget http://webserverIP in command line, I am getting this error - wget: can't open 'index.html': File exists

From telnet, i can see, the client can successfully ping the server. Strange is in access.log, I can see response code 200 for the wget command.

The index.html has all the permissions (chmod 777).

Can anyone please tell me why i am getting the error?

Ronni answered 19/9, 2013 at 16:41 Comment(0)
H
5

It means that directory you are in already contains file index.html.

# wget http://google.com/
Connecting to google.com (212.188.7.49:80)
Connecting to www.google.ru (64.233.161.94:80)
index.html           100% |*****************| 18381   0:00:00 ETA
# wget http://google.com/
Connecting to google.com (212.188.7.50:80)
Connecting to www.google.ru (64.233.161.94:80)
wget: can't open 'index.html': File exists
#
Hallah answered 9/11, 2014 at 9:28 Comment(0)
L
4

My guess is that on the client (which you have telnetted into), you do not have permission to write the file index.html. It looks like it already exists in your current directory. Please remove the file index.html in your current directory and try again. Please also make sure that you have permission to create files in the directory in which you issue the wget command.

The webserver has clearly sent the file correctly from the 200 response.

Lovemaking answered 22/9, 2013 at 20:4 Comment(0)
D
0

wget is unable to overwrite the file if it already exists in the directory it is trying to save to. Newer versions of wget appear to work around this by adding a sequential number to the file name if it detects a file conflict (ex: 'index.html (2)').

The first time you ran wget, index.html did not exist. wget ran and downloaded the index.html file to the default directory. The default directory is likely the current directory you are in (reference wget -h).

  • Run the ls command in the same directory you ran wget, and you'll likely see an 'index.html' file in the directory.
  • Run rm index.html to delete the file.
  • Run wget again, and you should be able to download the file.

Running wget -h

-P DIR Save to DIR (default .)

Dynatron answered 26/12, 2022 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.