FAQ
I have a script that opens an ftp connection to a non-*nix system.
I desire to change directories on the host system using a shell
variable to set the cd directory. However, I cannot seem to
discover how this is done.

I have tried this:

TARGET=ftp-pickup

ftp
. . .

cd $TARGET

This gives the following error:

550 Failed to change directory.

I am using shell variables (put $TEMP_TXFR_FILE $OUTPUT_FILE)
elsewhere in this ftp session as arguments to get and put statements
and I have no problems. Is there some reason why I cannot use shell
variables as arguments to the cd command?

I am aware the $ is used to invoke .netrc macros but I have none
defined. In fact I was somewhat surprised, albeit pleasantly, when
the ftp client accepted shell variables as arguments in the get and
put statements.

Is there a way to dynamically define the target of a cd command
inside an ftp session?

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB at Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

Search Discussions

  • Always Learning at Jul 21, 2011 at 4:52 pm

    On Thu, 2011-07-21 at 16:40 -0400, James B. Byrne wrote:

    I have a script that opens an ftp connection to a non-*nix system.
    I desire to change directories on the host system using a shell
    variable to set the cd directory. However, I cannot seem to
    discover how this is done.
    Check the FTP configuration file on the remote server. There might be a
    block to stop you moving-out of your log-on FTP directory.


    VSFTP on Centos has this capability so too, I imagine, has other FTP
    servers.

    --
    With best regards,

    Paul.
    England,
    EU.
  • John R Pierce at Jul 21, 2011 at 6:12 pm

    On 07/21/11 1:52 PM, Always Learning wrote:
    I have a script that opens an ftp connection to a non-*nix system.
    I desire to change directories on the host system using a shell
    variable to set the cd directory. However, I cannot seem to
    discover how this is done.
    Check the FTP configuration file on the remote server. There might be a
    block to stop you moving-out of your log-on FTP directory.
    more likely, the ftp program is processing his command lines, and it
    doesn't know anything about $parameter substitution.

    I suggest using wget or lftp or similar rather than conventional ftp.



    --
    john r pierce N 37, W 122
    santa cruz ca mid-left coast
  • Ljubomir Ljubojevic at Jul 22, 2011 at 7:12 am

    John R Pierce wrote:
    On 07/21/11 1:52 PM, Always Learning wrote:
    I have a script that opens an ftp connection to a non-*nix system.
    I desire to change directories on the host system using a shell
    variable to set the cd directory. However, I cannot seem to
    discover how this is done.
    Check the FTP configuration file on the remote server. There might be a
    block to stop you moving-out of your log-on FTP directory.
    more likely, the ftp program is processing his command lines, and it
    doesn't know anything about $parameter substitution.

    I suggest using wget or lftp or similar rather than conventional ftp.

    +1 for lftp, very scriptable.

    --

    Ljubomir Ljubojevic
    (Love is in the Air)
    PL Computers
    Serbia, Europe

    Google is the Mother, Google is the Father, and traceroute is your
    trusty Spiderman...
    StarOS, Mikrotik and CentOS/RHEL/Linux consultant

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcentos @
categoriescentos
postedJul 21, '11 at 4:40p
activeJul 22, '11 at 7:12a
posts4
users4
websitecentos.org
irc#centos

People

Translate

site design / logo © 2022 Grokbase