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-’.)
6.2.10 The put command: send a file to the server
To upload a file to the server from your local PC, you use the put command.
In its simplest form, you just use this with a file name:
put myfile.dat
If you want to store the file remotely under a different name, specify the remote file name after the local one:
put myfile.dat newname.dat
This will send the local file called myfile.dat, but will store it on the server under the name newname.dat.
To send an entire directory recursively, you can use the -r option:
put -r mydir
put -r mydir newname
(If you want to send a file whose name starts with a hyphen, you may have to use the -- special argument, which stops put from interpreting anything as a switch after it. For example, ‘put -- -silly-name-’.)
6.2.11 The mget and mput commands: fetch or send multiple files
mget works almost exactly like get, except that it allows you to specify more than one file to fetch at once. You can do this in two ways:
•by giving two or more explicit file names (‘mget file1.txt file2.txt’)
•by using a wildcard (‘mget *.txt’).
Every argument to mget is treated as the name of a file to fetch (unlike get, which will interpret at most one argument like that, and a second argument will be treated as an alternative name under which to store the retrieved file), or a wildcard expression matching more than one file.
The -r and -- options from get are also available with mget.
mput is similar to put, with the same differences.
6.2.12 The reget and reput commands: resuming file transfers
If a file transfer fails half way through, and you end up with half the file stored on your disk, you can resume the file transfer using the reget and reput commands. These work exactly like the get and put commands, but they check for the presence of the half-written destination file and start transferring from where the last attempt left off.
The syntax of reget and reput is exactly the same as the syntax of get and put:
reget myfile.dat
reget myfile.dat newname.dat
reget -r mydir