[SunHELP] ftp recursively.

sunhelp at sunhelp.org sunhelp at sunhelp.org
Wed Jul 18 15:01:45 CDT 2001


 I'm sorry, I was in a hurry when I replied earlier and
didn't finish. A couple of other replies pointed out
that the stock ftp client won't do this auotmagically for
you. You can do it interactively, however by using the
ftp client commands (like the "prompt off" example) to 
create the subdirs. Otherwise you would need to use a
different application for ftp'ing.

 Here's a very quick example of what I mentioned above
(it's hurried because I'm about to leave town for a few
days)

cd /home/user/testftp
ftp -i some.ftp.net
ls -la
mget *   (only gets current dirs files (not subdirs)
!mkdir subdir1
!mkdir subdir2/sub-subdir2
mget * (still behaves as above)
mget */* (grabs files under first level of subdirs
           and puts them in their corresponding
            subdirs under /home/user/testftp/dir1/subdirs)
mget */*/* (like above, but works on 2nd level of subdirs
             i.e.- subdir2/sub-subdir2 level)

 But as is obvious, this method requires interaction on
your part and there are ftp clients that _will_ do this
automatically for you. This is good if you either don't
want another ftp client (and don't mind the interaction)
or are unable to add another ftp client to the system.

 -david

> David,
> 
> Can I use ftp to get the directory as well? I mean that it creates the
> remote directory on local host and mget the files into it?
> 
> Thanks!
> Andrew
> 
> -----Original Message-----
> From: dhansen at zebra.net [mailto:dhansen at zebra.net]
> Sent: Wednesday, July 18, 2001 12:54 PM
> To: sunhelp at sunhelp.org
> Subject: Re: [SunHELP] ftp recursively.
> 
> 
> 
>  Man ftp. Give ftp either the -i switch or interactively give it the "prompt
> off" command.
> Then use
> "mget <string>" to get multiple files.
> i.e.-
> ftp -i blah.ftp.net
> mget *
> or 
> ftp blah.ftp.net
> prompt off
> mget *
> 
> 
>  -david
> 
> > Can anyone tell me how to ftp all files in one directory and its
> > subdirectory? At ftp prompt, what subcommand or option I should use to do
> > it?





More information about the SunHELP mailing list