Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

IFTP, current directory, open new connection

Charles Dye

Super Moderator
May
4,938
126
Staff member
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.
 

Similar threads

Back
Top