Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you download a file/zip from the commandline using putty?

Tags:

cmd

putty

7zip

I'm trying to write a batch script (CMD @ Windows XP Pro) that will automatically download and unzip packages with the help of 7zip and putty/psftp

If I have a URL to a package to download http://somesite.org/packages/package.zip how do I download it on command line using putty?

Also if you have a better way to do this that would be helpful too.

like image 476
qodeninja Avatar asked Oct 23 '09 20:10

qodeninja


People also ask

How do I download a folder from PuTTY?

Just input the IP, Host + Pwd, then can copy and paste from/to server/local pc.

How do you download zipped files?

A ZIP file is a container for other files. ZIP files compress their contents, which reduces downloading time. To download a ZIP file, click on a link to it; this will prompt your browswer to ask you if you would like to open or save the file. Select Save.


1 Answers

wget is of course an obvious solution, but I also suggest to have a look at cURL. From their website:

curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks.

Of course free and open source, and despite its huge list of supported protocols it's as simple to use as wget, so to use your example

curl -O http://somesite.org/packages/package.zip 

downloads package.zip to a local file with the same name

curl -o myname.zip http://somesite.org/packages/package.zip 

downloads package.zip as myname.zip

curl http://somesite.org/packages/package.zip > package.zip 

redirects curl's stdout to package.zip

EDIT - example corrected, with thanks to @PrabhakarKasi

like image 87
fvu Avatar answered Sep 21 '22 13:09

fvu