1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

IFTP, current directory, open new connection

Discussion in 'Support' started by Charles Dye, Jul 16, 2012.

  1. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    I was having trouble the other day with a batch file which uploads files to multiple servers. The script opens a connection to server A with IFTP, sets the current directory with CD FTP:, copies files, and then closes the connection with IFTP /C, then repeats the process with server B. The problem is that when opening a new connection to server B, IFTP attempts to set the current directory to the remembered current directory from server A. Unless the same directory exists on both, this doesn't work, and IFTP fails with an error message.

    I tried adding a forward slash to the end of the IFTP parameters string, but for reasons I don't understand that didn't help. I was able to work around the problem by adding a CD FTP:/ before the IFTP /C.

    I think this situation might be better handled in one of two ways:

    1. (simple) When closing a connection with IFTP /C, always reset the current directory to the root.

    2. (complicated) When opening a connection with IFTP, if there was a previous connection, compare server names. If the name of the server being opened does not match the server name of the prior connection, reset the CWD to the root.
     

Share This Page