Thread: How do I run ftp in line with Msys?

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    How do I run ftp in line with Msys?

    I have been using Msys for my Unix Programming course and it works great, beats logging onto a remote machine through PuTTY to connect when I can have everything on my local computer. The only problem is I can't create shell scripts that work properly with the ftp command because it opens in a seperate window and doesn't accept any commands from the script after it is invoked. Is there a way to fix it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Code:
    $ ftp -h
    
    Transfers files to and from a computer running an FTP server service
    (sometimes called a daemon). Ftp can be used interactively.
    
    FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [-A] [host]
    
      -v             Suppresses display of remote server responses.
      -n             Suppresses auto-login upon initial connection.
      -i             Turns off interactive prompting during multiple file
                     transfers.
      -d             Enables debugging.
      -g             Disables filename globbing (see GLOB command).
      -s:filename    Specifies a text file containing FTP commands; the
                     commands will automatically run after FTP starts.
      -a             Use any local interface when binding data connection.
      -A             login as anonymous.
      -w:buffersize  Overrides the default transfer buffer size of 4096.
      host           Specifies the host name or IP address of the remote
                     host to connect to.
    
    Notes:
      - mget and mput commands take y/n/q for yes/no/quit.
      - Use Control-C to abort commands.
    Prepare a script file in your shell, then invoke FTP with that script.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    nice. So if I wanted to write a script to work with ftp, then go back to the shell and have the script execute commands there, I would essentially write one file with all the ftp commands, then invoke in the script all that with the parameter of the file. Is there a way to pipe or redirect what's in the script as a file to ftp?

  4. #4
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Msys's ftp doesn't have that option. When I try to use it it flashes the ftp but does nothing.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    But msys ftp is just a thin wrapper around the win32 ftp program, viz
    Code:
    $ cat /bin/ftp
    #!/bin/sh
    # Copyright (C) 2002, Earnie Boyd
    #   mailto:[email protected]
    # This file is part of Minimal SYStem.
    #   http://www.mingw.org/msys.shtml
    # File: ftp
    
    cmd //c start ftp "$@"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I was looking more for the unix type ftp that runs inline with the rxvt. Mainly to be compatiable when I upload it to my school home directory for turning it in.

    Edit; and it's still not working with the syntax changed
    Last edited by indigo0086; 07-11-2007 at 09:46 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Imposing Line Numbers automatically in the C code
    By cavestine in forum C Programming
    Replies: 14
    Last Post: 10-15-2007, 12:41 AM
  2. Run MFC exe from Command Line
    By magic.mike in forum Windows Programming
    Replies: 6
    Last Post: 09-08-2005, 02:00 PM
  3. Trouble replacing line of file
    By Rpog in forum C Programming
    Replies: 4
    Last Post: 04-19-2004, 10:22 AM
  4. Read only one line using seekg
    By RedZippo in forum C++ Programming
    Replies: 3
    Last Post: 03-31-2004, 11:10 PM
  5. How can I run a small ftp script from C program
    By bazeemuddin in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-01-2003, 05:04 PM