FTP single-line upload Terminal command

Discussion in 'Mac Programming' started by Terminal001, Dec 23, 2010.

  1. Terminal001 macrumors newbie

    Joined:
    Dec 23, 2010
    #1
    Hello everyone!

    Is there a way to upload files to an FTP server with a single-line command?
    Something like:
    ftp login:pass@localhost mput "files" ?
    Without having to connect first, and then execute mput.

    Thank you!
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    I haven't had to do this, but from the manpage it looks like you can setup an entry in your .netrc file with login information and a macro definition called init. This will result in auto-login and running of the macro when you run:
    ftp servername

    Check out the ftp man page, and play with this. You might need the -i option to allow an unprompted mput.

    -Lee
     
  3. lloyddean macrumors 6502a

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
  4. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #4
    Gotta love curl! I used to use wget, but since curl is pre-installed on OS X I've developed a healthy respect for it.

    B
     
  5. Terminal001 thread starter macrumors newbie

    Joined:
    Dec 23, 2010
    #5
    Thanks a lot guys! Both solutions are really clever, but I guess the use of Curl would be more elegant. Love the macro-script idea though!
     
  6. elmsley macrumors newbie

    Joined:
    Dec 24, 2010
    #6
    Investigate something called "here documents" for a different kind of answer.
     

Share This Page