FTP in a terminal

Discussion in 'Mac Apps and Mac App Store' started by tidyboy, Dec 10, 2006.

  1. tidyboy macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #1
    Hi there I am having problems with ftp in a terminal

    How do i ftp a folder with files in from my laptop to my server. I just need to know what command to use I have looked at man ftp but i really new to this.


    Many Thanks

    Matt
     
  2. JBot macrumors 6502

    Joined:
    Jan 9, 2006
    Location:
    Calgary.Alberta.Canada
    #2
    Can you not use the 'get' and 'put' commands working?

    Also, firefox has a ftp plugin, FireFTP, give it a look.
     
  3. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #3
    unless you zip up the folder, you'll have to do it in two steps: create the remote folder, then put all the files.

    the trick is to start ftp with the -i flag, which will turn off interactive mode:
    Code:
    % ftp -i ftp.foo.org
    
    after you've gotten to the correct folder, you'll use mput (multiple put) instead of normal put. use wildcards to match the files in your local directory:
    Code:
    > mput *.html
    
    if you leave interactive mode on, you'll be prompted for each file it finds.
     
  4. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #4
    Hi there Thanks for replying.

    Yes I can get the put and get commands working but when I use them it only ftp's the files and not the folders.

    What am I doing wrong?


    MAtt
     
  5. tyr2 macrumors 6502a

    tyr2

    Joined:
    May 6, 2006
    Location:
    Leeds, UK
    #5
    Not sure that you can do a recursive ftp put. The man page advises:

    Note: mget, mput and mreget are
    not meant to transfer entire directory subtrees of files.
    That can be done by transferring a tar(1) archive of the sub-
    tree (in binary mode)

    Is there a reason you need to use the terminal? You can connect to a FTP server with Finder (Go/Connect to server), you can then drag and drop the files.
     
  6. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #6
    Hi there I just like using the terminal :)

    If I ftp a .zip file what are the commands to unzip the archive please.


    Many Thanks
     
  7. tyr2 macrumors 6502a

    tyr2

    Joined:
    May 6, 2006
    Location:
    Leeds, UK
    #7
    Yeah me too. Have you considered using 'scp' rather than 'ftp', depends if you server supports it obviously. 'scp' can handle recursive copies fine.

    You need to unzip them on the server, you can't do it via ftp. Log on to the server and just use 'unzip'
     
  8. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #8
    Can you explain about scp please. And how to use commands for it
     
  9. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #9
    Code:
    % man scp
    
    stop being lazy.
     
  10. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #10
    Im not being lazy I am new to all this and I need help. I dont need people callin g me lazy I thought this was a forum to help people!
     
  11. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #11
    you are being lazy, and this is helping you. if you'd read my original post, you'd see that you can't use ftp to copy a folder and its files. i then told you how to operate ftp the way you want.

    if you can't be bothered to read and/or understand responses, then we can't be bothered to try to help you.
     
  12. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #12
    Well luckily, that's what man pages are for. Man being short for 'manual'.
    Since you like using the command line, learning to use/read man pages is a very important skill to possess.
     
  13. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #13
    You're not reading what he wrote precisely.

    The man pages definitely have more information.
     
  14. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #14
    Right I did do what zimv20 said but it did not upload the folders. Right im not being funny but like I said im new to this so a little extra detail would be handy.


    Many Thanks
     
  15. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #15
    OK, say you're sitting in a directory and you have a folder called "pictures" that you want to FTP. Here's how you do it. Watch closely...

    ftp myserver.com
    (login as needed)
    prompt
    (FTP says "Interactive mode off.")
    lcd pictures
    (FTP says "Local directory now /blah/blah/pictures")
    mkdir pictures
    (FTP says "pictures: the directory was successfully created")
    cd pictures
    (FTP says "OK. Current directory is /www/blah/pictures")
    mput *
    (FTP uploads every file in the directory)

    Make sense now?
     
  16. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #16
    Hi there thanks for replying

    I understand what you are saying in your example but what I am tyring to do is ftp the invision power board forum software files to my server.

    I need to keep the directory structure so how do I ftp the whole thing over.
     
  17. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #17
    You are in for a long night.

    mkdir forum
    cd forum
    lcd forum
    mput *
    mkdir bin
    cd bin
    lcd bin
    mput *
    cd ..
    lcd ..
    mkdir images
    cd images
    lcd image
    mput *
    ...

    And so on. One set of mkdir/cd's/mput's for every single directory. And don't forget to chmod the directories correctly, some will be 755, some 777... don't get that wrong or you'll have a non-working board, or a huge security risk, or both.

    I've done it. It's tedious. Do you REALLY want to use the terminal ftp for this? You should consider a GUI app that will take care of that for you, or scp, or... something.
     
  18. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #18
    Look for Cyberduck on http://www.macupdate.com/ or http://www.versiontracker.com/ and download and install it. Then, run it, set up your server information and log into that server. Then, drag the folder to where you want it to be on the server.

    It'll be a lot easier for you and the software is free and reliable.
     
  19. tidyboy thread starter macrumors newbie

    Joined:
    Dec 10, 2006
    Location:
    Coventry UK
    #19
    Thanks thats what I thought :)
     
  20. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #20
    Good luck!

    CyberDuck is a nice program.
     

Share This Page