Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a unix command I can use to pull a file from a URL and put it into a directory of my choice? So I have a URL which if you go to it, a file will be downloaded. I want to be able to type a unix command to download the linked file from the URL I specify and place it into a directory of my choice.

So if the URL www.example.com/image.png. I want to type a unix command to download the image.png file, I want to put that file into my examples/ directory

Is this possible?

Thanks!

share|improve this question

migrated from stackoverflow.com Jun 14 '11 at 23:25

This question came from our site for professional and enthusiast programmers.

    
I've tried curl and wget as suggested; however, I do not believe the file is finishing downloading. The file I am attempting to download is a .apk (android app) Thanks for all suggestions so far –  Corey Jun 14 '11 at 21:37
    
Both curl and wget provide progress indication for downloads. –  Brandon E Taylor Jun 14 '11 at 21:49
    
Yes they do and they say 100%; however, I don't think it is correct. try for yourself. I am using the following URL to test: http://www.freewarelovers.com/android/download/temp/1280424320_ASTRO_File_Manag‌​er_2.5.2.apk First try with both curl and wget then go to the URL directly and compare the results –  Corey Jun 14 '11 at 21:51
    
And I've also got an error when trying wget Connecting to www.freewarelovers.com|50.16.198.100|:80... connected. HTTP request sent, awaiting response... No data received. Retrying. –  Corey Jun 14 '11 at 21:55
    
I suspect the freewarelovers site has set things up such that you cannot directly download the resource using the URL you provided. –  Brandon E Taylor Jun 14 '11 at 22:02

2 Answers 2

Meet your new friend, wget:

wget -O examples/image.png www.example.com/image.png

Also

man wget

for more usage details.

share|improve this answer
wget -P examples/ www.example.com/image.png

and

curl -o examples/image.png www.example.com/image.png

both work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.