Alex
Alex

Reputation: 21

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

Upvotes: 1

Views: 6585

Answers (2)

woodleader
woodleader

Reputation: 923

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

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

Upvotes: 1

ajpyles
ajpyles

Reputation: 628

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.

Upvotes: 0

Related Questions