FTP in Unix?

calbear2000

Golden Member
Oct 17, 2001
1,027
0
0
How do you ftp a whole directory in Unix?

I don't think its mget/mput...?

Sorry to ask here, but no one seems to know in the Software forum.


Thanks
 

777php

Diamond Member
Jul 17, 2001
3,498
0
0
use the scp command in unix.

scp [-aAqQprvBCL1] [-S path-to-ssh] [-o ssh-options] [-P port] [-c cipher]
[-i identity]
[[user@]host1:]filename1... [[user@]host2:]filename2

OPTIONS


-aTurn onstatistics display for each file.

-ATurn off statistics display foreach file.

-c cipher
Selectsthe cipher to use for encrypting the data transfer. This
option is directly passed to ssh.

-i identity_file
Selectsthe file from which theidentity (private key) for RSA
authentication is read. This option isdirectly passedto ssh.

-LUse nonprivileged port. With this you cannot use rhosts or
rsarhosts authentications, but it can be used to bypasssome
firewalls that dont allow privileged source ports to pass. Sameas
saying "-o UsePriviledgePort=no" or -P to ssh; -L is used due to
exhaustion of suitable letters.

-1Force scp to use command "scp1"on the remote side instead of "scp".
This may be necessary in some situations, if the remotesystem has
"scp2" symlinked to "scp".

-o ssh-options
Ssh options passed to ssh.


-CCompression enable. Passes the-C flagto ssh to enable compression.

-P port
Specifies the port to connect to on theremote host. Note thatthis
option is written with a capital P, because -p is already reserved
for preserving the times and modes of the file in rcp.

-S path-to-ssh
Specifies the path to ssh program.
 

manly

Lifer
Jan 25, 2000
12,261
3,172
136
You can use mget if you want all the regular files in a directory, but basic ftp does not do recursive descent. So for example:

ftp> open ftp.somehost.com
// auth
ftp> cd /pub/some/path/
ftp> !mkdir -p /tmp/local/path
ftp> lcd /tmp/local/path
ftp> binary
ftp> mget *

Personally, I rarely use an ftp client these days because wget (a CLI downloading/mirroring tool) is so useful. The equivalent to above could be:

$ mkdir -p /tmp/local/path
$ cd /tmp/local/path
$ wget -nd -r ftp://ftp.somehost.com/pub/some/path

The -r parameter enables recursive descent, so wget is a very useful mirroring tool. It does a lot more than I've shown in this basic example.