I would like to script a complex scenario of file transfers from Linux to a Windows FTP server (detecting new/changed files and then transfer) and I am unable to find a command-line ftp client which supports sending files over a persistent (one time login) session on non-interactive mode.
ssh/scp
with password-less authentication is not an option, since I have no access to the Windows FTP server.
For example using lftp
`lftp -u user,pass -p 21 -e "mput newfile.txt;"` 10.0.0.100
will upload my file to the server, but requires authentication/handshaking to happen on every request, which takes a long time and severely slows down the transfers.
I am wondering whether there is a way to authenticate once, establish a persistent connection and then sending the files over this connection. lftp
and other clients are able to do this in interactive mode (connect and then perform multiple commands until quitting).
Therefore:
- Is there an FTP client on Linux which may operate like this in non-interactive mode?
- Alternatively, is there a way to simulate this behaviour, scripting over the interactive mode? Maybe something utilizing
expect
withnetcat/telnet
and/or named pipes?
Untested, but you can do something like this Tcl:
The expect would be similar. untested: