Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Linux command line FTP

  • 14-12-2005 10:24pm
    #1
    Registered Users, Registered Users 2 Posts: 1,086 ✭✭✭


    Anyone know how to copy via FTP on linux command line multiple directories and not just multiple files.

    At present I am using the 'mput' command but I don't think this works for directories and their contents.

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭SwampThing


    You'll have to cd into each directory and do and mput for the files in each directory.

    You could write a wee shell script to do it -

    ftp to server; cd to top directory; do a 'list' command out to a file; use this list file to control a 'for loop' which loops thru each direcroty in the list and does the mput command for each directory.

    If you need a hand, let me know


  • Registered Users, Registered Users 2 Posts: 1,086 ✭✭✭Peter B


    Thanks for the info.
    Wouldn't know where to start though. What language would you write it in? Would you need a recursive function or something similar to copy sub-folders and sub-sub-folders?

    Anywhere on the web I could find an already completed script?


  • Closed Accounts Posts: 12,807 ✭✭✭✭Orion


    Write a command line script. FTP is OS-independent - the commands are the same no matter what OS you are using. What SwampThing suggested is the best/(only) way to do it from the command line.


  • Registered Users, Registered Users 2 Posts: 1,086 ✭✭✭Peter B


    Any help with a command line script would be greatly appreciated.


    Need some sort of loop where after connection in root directory...

    function LS()
    ls command in local server

    ****loop for each result
    {
    if (directory)
    {
    mkdir directory_name;
    cd directory_name;
    run function LS();
    }
    else ***not a directory
    {
    ftp file to current directory position;
    }
    }
    ****end loop



    end connection


    Is this a similar structure?


  • Registered Users, Registered Users 2 Posts: 2,013 ✭✭✭lynchie


    Install ncftp on the machine and do a get -R <directory> to recursively copy directories.

    noticed you mentioned command line.. if u are doing it in a script ncftpget is the command line version of it too..


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    lynchie ftw. You lot with your complicated scripts and recursion malarky. :P


  • Registered Users, Registered Users 2 Posts: 1,086 ✭✭✭Peter B


    Well the problem is I am copying files from an old college account to my webspace. My webspace is not supposed to have ssh access even though I can access the command line when I connect through command line from my old college account using 'ftp ftp.myaccount.com'.

    Will it be possible to install these programs on my college account or will I have to contact the administrator?

    How will I know is ncftpget is installed or not?


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    That's not a shell command line you're at...it's an ftp command line.

    What you want to do at your college login is:

    which ncftp (will tell you where it is)

    and

    ncftp yourdomain.ie

    will connect you.


Advertisement