I have for example database backups on my Linux server, and I would like to write a script to upload it to remote FTP. I tried the put
command, but it can only transfer one file at a time. Then I tried the mput command, but it just shows me question marks for files I want to transfer (maybe I'm using it wrongly?..)
I tried this:
#!/bin/bash
ftp -n <<EOF
open ftp.server.com
user name password
cd backup
mput /backup/*
EOF
But it won't work. It outputs names of files I want to transfer with question marks at the end of names. Am I missing something or maybe there is better simpler way?
Best Answer
Take a look at
ncftp
, it comes with an utility (ncftpput
) that can be scripted for this purpose:The
-R
flag means recursive mode. You can have your authentication details in a separated file. See the manpage (ncftpput(1)
) for details.