简体   繁体   中英

Upload file to remote server

Have a problem. I need to upload file to remote ftp server using linux bash.. smth like this: cp file.tar.gz ftp://username:password@host/file.tar.gz Can it be done?

Thanks in advance, Alex

I would use http://www.ncftp.com/ for this.

//see comment => "Specifically, take a look at ncftpput."

You can use just plain ftp + bash for this.

Bash script begin:

echo "put $1" > commands.txt;

echo "quit" >> commands.txt;

ftp user@ftp://username:password@host < commands.txt

Bash script end.

Put that in ftp.sh. run it like ./ftp.sh file.tar.gz. this will upload to the ftp server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM