How to upload a directory recursively to an FTP server by just using ftp or lftp?

Solution 1:

lftp should be able to do this in one step, in particular with lftp mirror:

The lftp command syntax is confusing, original invocation I posted doesn't work. Try it like this:

lftp -e "mirror -R {local dir} {remote dir}" -u {username},{password} {host}

note the quotes around the arguments to the -e switch.

Solution 2:

cd {local_dir}
lftp {server}
cd {remote_dir}
mput {local_dir}/*

This worked for me, many other attempts were failing. Once in lftp, more info available via:

help mput