steros
steros

Reputation: 1924

wget & curl output "No such file or directory"

wget https://some.url/with/a/file.txt

Returns No such file or directory despite file.txt being present at the location (can be downloaded via browser). Also the directory to save to is writeable by the user running the command.

Upvotes: 6

Views: 22605

Answers (3)

SenatorWaffles
SenatorWaffles

Reputation: 380

Stumbled upon this with a similar issue using curl. The root cause for me was curl was unable to find the destination directory.

adding --create-dirs to the command will ask curl to create the directories if they do not exist, which solved my issue.

eg.

# I want to download this file to ~/development/csvs/saved_file.csv
# Assume I am executing from a ~/development/ directory, which has no csv dir

# this will not work
curl 'https://bla.com/cool_csv.csv' > csvs/saved_file.csv

# this will work
curl 'https://bla.com/cool_csv.csv' -o csvs/saved_file.csv --create-dirs

-o will replace > and will specify output

reference question

Upvotes: 1

Sheikh Aafaq Rashid
Sheikh Aafaq Rashid

Reputation: 199

Close the terminal and try again to run the script.

Upvotes: 1

steros
steros

Reputation: 1924

There are a lot of related threads but nothing helped.

Finally found out there is an illegal character in front of the url!

That was so hard to find I post it here in case anyone stumbles upon the same.

Upvotes: 27

Related Questions