How to upload multiple files to FTP from Linux server?
Take a look at ncftp
, it comes with an utility (ncftpput
) that can be scripted for this purpose:
$ ncftpput -R ftp.server.com /remote/path /backup
The -R
flag means recursive mode. You can have your authentication details in a separated file. See the manpage (ncftpput(1)
) for details.
Another alternative might be to use CurlFtpFS, a FUSE file system driver that exposes a FTP host as a mounted directory (allowing you to access those files with any regular tools, including cp
). I don't know how well it works, but from a quick googling around it looks very promising. CurlFtpFS goes back further than does FUSE actually, so should be stable.
To use it, install the appropriate package for your distribution (for example, Arch and Debian use the package name curlftpfs
), load the fuse
module, and sudo curlftpfs ftp.example.com /mnt/ftp/ -o user=username:password,allow_other
, substituting appropriate values for server name, mount point, user name and password.
There are further details at the linked page but that should get you started.
You could use lftp
lftp ftp://user:[email protected] -e "mirror -e -R /local/folder /remote/folder ; quit"