6.2.9 The get
command: fetch a file from the server
To download a file from the server and store it on your local PC, you use the get
command.
In its simplest form, you just use this with a file name:
get myfile.dat
If you want to store the file locally under a different name, specify the local file name after the remote one:
get myfile.dat newname.dat
This will fetch the file on the server called myfile.dat
, but will save it to your local machine under the name newname.dat
.
To fetch an entire directory recursively, you can use the -r
option:
get -r mydir
get -r mydir newname
(If you want to fetch a file whose name starts with a hyphen, you may have to use the --
special argument, which stops get
from interpreting anything as a switch after it. For example, ‘get -- -silly-name-
’.)