Find the answer to your Linux question:
Results 1 to 5 of 5
Hi All, Sorry about the rather newbie question, but I was just wondering how I can save a lot of time. Basically I'm using SFTP to connect to a server ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! bonzocs's Avatar
    Join Date
    Jun 2006
    Location
    Cardiff Wales/UK
    Posts
    51

    get sub directories using get cmd


    Hi All,

    Sorry about the rather newbie question, but I was just wondering how I can save a lot of time.

    Basically I'm using SFTP to connect to a server and want to download hundreds of files which are divided into a complex tree of subdirectories. If I use:

    sftp> get *

    I only get the files not the subdirectories? Does anyone know the cmd t download everything within the directory including the subdir's.

    Thanks

  2. #2
    Linux User
    Join Date
    Jun 2006
    Posts
    311
    Hi bonzocs,
    You can do that in lftp using mirror command.

    lftp username@URL:~> mirror directory_name_containing_lots_of_subdirectories
    In case you do not want it to be done recursively, you can use -r option with mirror command.

    With Regards,
    Thinker

  3. #3
    Just Joined! bonzocs's Avatar
    Join Date
    Jun 2006
    Location
    Cardiff Wales/UK
    Posts
    51
    Hi Thinker, thanks for the reply.

    I've never used lftp ? Had a go to connecting but I'm getting a mixed response ranging from timeout to no such tcp service?

    I typed in the following :

    lftp root@domain.co.uk:~> mirror httpdocs/
    Alternatively is there a way to do it through sftp?

    Thanks Again

  4. #4
    Linux User
    Join Date
    Jun 2006
    Posts
    311
    Hi bonzocs,
    I am sorry, but you misinterpreted the command that I quoted. Actually,
    lftp username@URL:~>
    is the prompt that you see after you use lftp and login to the FTP site.

    I assumed you might be aware of lftp. I will explain : -
    To login to your ftp site,
    $ lftp URL -u username,password
    Then, you will see a prompt like what I had mentioned first.

    Now, type mirror httpdocs in that prompt which will look like as follows : -
    lftp username@URL:~> mirror httpdocs
    You should be able to get all the contents of httpdocs including subdirectories and their contents right at the location from where you started lftp.

    lftp has lot of other options too. To learn more : -
    $ man lftp
    With Regards,
    Thinker

  5. #5
    Just Joined! bonzocs's Avatar
    Join Date
    Jun 2006
    Location
    Cardiff Wales/UK
    Posts
    51
    Hi Thinker,

    Thanks for the detailed response it worked great. You have now introduced me to lftp thanks! Much appreciated

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •