× English Section!

We will be more than happy to help you with problems related to our services and products. Please feel free to write it down as clear as possible

Download file from remote server using cURL or Wget.

Περισσότερα
5 Χρόνια 3 Μήνες πριν - 5 Χρόνια 3 Μήνες πριν #71 από infogate
cURL :

The powerful curl command line tool can be used to download files fromany remote server. The command line users know this can be useful for a wide variety of situations, but to keep things simple, many will find that downloading a file with curl can often be a quicker alternative to using a web browser or FTP client from the GUI side of OS X (or linux). This is is helpful for local situations, but there’s particular value if you’re in a situation where you need to download something to a remote Mac when connected through SSH.



Saving a Remote File with a Different Name with curl -o
curl -o [new_file_name] [url]
OR
curl -# [url] > [new_file_name]

example :
curl -o download.txt http://example.com/dir/download-file.txt
OR
curl -# http://example.com/dir/download-file.txt > download.txt


Cancel your download by [ctrl+c] and resume the same by [-C -]. Here - checks from where the download start automatically.
curl -O http://example.com/download.mp4

To resume the above download.
curl -O -C - http://example.com/download.mp4

#put -C - just before download URL


If you’d rather not save the file to the present working directory, specify a path as part of the file name like so:
curl -o ~/Desktop/test.txt http://example.com/dir/test.txt

Downloading Multiple Files Concurrently with curl

cURL can easily download multiple files at the same time, all you need to do is specify more than one URL like so :
curl -O [URL 1] [URL 2] [URL 3]
example :
curl -O "http://example.com/dir/test.txt" "http://example.com/dir1/test1.txt" "http://example.com/dir/test1.txt"

On the other hand, if the file names to be downloaded are using incremental naming, you can use brackets to specify a download range, like so :
curl -O http://example.org/dir/Licenses/fd1-1[1-3].txt
This above command would grab the files fdl-1.1.txt, fd1-1.2.txt, and fd1-1.3.txt all at the same time without having to specify each unique URL. Of course this only works if the files are in the same directory together and at the same domain.



Authenticating with curl :

You can also pass authentication with cURL by using the -u flag:

curl -u user:pass -O ftp://example.com/file-to-download.zip
Keep in mind that bash history will store the password in plain text when using -u with a username and password specified, thus this is not recommended for most situations. You can get around that by placing a space in front of ‘curl’. If you don’t use the spacebar to prefix the command, you’ll probably want to empty the command history afterwards to be safe.



Options :-

-
#, --progress-bar
              Make curl display progress as a simple progress bar instead of the standard, more informational, meter.

-:, --next
              Tells curl to use a separate operation for the following URL and associated options. This allows you to send several  URL  requests,  each  with
              their own specific options, for example, such as different user names or custom requests for each. (Added in 7.36.0)

-C, --continue-at 
              Continue/Resume  a previous file transfer at the given offset. The given offset is the exact number of bytes that will be skipped, counting from
              the beginning of the source file before it is transferred to the destination.  If used with uploads, the FTP server command  SIZE  will  not  be
              used by curl.
              Use  "-C  -"  to  tell curl to automatically find out where/how to resume the transfer. It then uses the given output/input files to figure that
              out.
              If this option is used several times, the last one will be used.

-o, --output 
              Write output to  instead of stdout. If you are using {} or [] to fetch multiple documents, you can use '#' followed by  a  number  in  the
               specifier. That variable will be replaced with the current string for the URL being fetched. Like in:
                curl http://{one,two}.site.com -o "file_#1.txt"
              or use several variables like:
                curl http://{site,host}.host[1-5].com -o "#1_#2"
              You may use this option as many times as the number of URLs you have.
              See  also the --create-dirs option to create the local directories dynamically. Specifying the output as '-' (a single dash) will force the out‐
              put to be done to stdout.

-O, --remote-name
              Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.)
              The remote file name to use for saving is extracted from the given URL, nothing else.
              Consequentially, the file will be saved in the current working directory. If you want the file saved in a different  directory,  make  sure  you
              change current working directory before you invoke curl with the -O, --remote-name flag!
              There is no URL decoding done on the file name. If it has %20 or other URL encoded parts of the name, they will end up as-is as file name.
              You may use this option as many times as the number of URLs you have.
Wget :

To download a file using wget command from remote server.
wget "https://example.com/backup-lenthy_name.zip"

*Σε λειτουργικό CentOS αυτό θα οδηγήσει σε κατέβασμα του αρχείου στον φάκελο "Root"


cURL and Wget Download Instructions

Windows
Wget - gnuwin32.sourceforge.net/packages/wget.htm
cURL - curl.haxx.se/download.html


The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal

Last edit: 5 Χρόνια 3 Μήνες πριν by infogate.

Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.

Χρόνος δημιουργίας σελίδας: 0.084 δευτερόλεπτα
Powered by Kunena Φόρουμ