Re: ftp question
On Dec 3, 2004, at 11:34 AM, disciple@exis.net wrote:
How do you transfer an entire directory using ftp? The directory that
I'm
trying to transfer has a lot of "subdirectories" in it.
If you are just talking about _retrieving_ a directory tree via ftp ....
I use wget ('man wget'). I don't know what packages drag it in, but
`sudo apt-get install wget` will get you it if you don't already have
it.
Example 1:
wget -r ftp://ftp.perl.org/pub/CPAN/misc/xbm
(Note that -r is short for --recursive.)
This will create:
ftp.perl.org
ftp.perl.org/pub
ftp.perl.org/pub/CPAN
ftp.perl.org/pub/CPAN/misc
ftp.perl.org/pub/CPAN/misc/xbm
ftp.perl.org/pub/CPAN/misc/xbm/x.faces.camel.xbm
ftp.perl.org/pub/CPAN/misc/xbm/x.faces.perl.xbm
(If xbm had any subdirectories, those would also be included).
Example 2:
To avoid creating any directories other than the one you want, you need
to also use the --no-host-directories (-nH) and --cut-dirs (no short
switch):
wget -r -nH --cut-dirs=3 ftp://ftp.perl.org/pub/CPAN/misc/xbm
This command creates:
xbm
xbm/x.faces.camel.xbm
xbm/x.faces.perl.xbm
The --cut-dirs leaves off the specified number of directories, starting
with the topmost directory, so its argument is always dependent on the
number of directories between the one you want and the root directory.
Kevin Murphy
Reply to: