publish a file to a ftp site from terminal


Forum: Other Help Topics
Topic: publish a file to a ftp site from terminal
started by: Patrick

Posted by Patrick on Feb. 18 2005,12:05
I need to copy a file (CalendarDataFile.ics) to my ftp-site, i need to do this from a script. So i need a command to copy a file to a ftp-site and in this file i need to state the password for the ftp-site. Sorha like the  bookmark-synchroniser in Firefox (passive transfer is not possible so i need to state the password)

Help?

Posted by tronik on Feb. 18 2005,14:00
Code Sample
#/bin/sh
PEER1="host port"
PEER1UPASS="password"
FILENAME="file.tgz"

_ftp () {
echo "open $PEER1
user $PEER1UPASS
bin
prompt
put $FILENAME $FILENAME
close
bye" | ftp -i -in


that should do it. ;) enjoy. if you  have any more questions lemme know. (should work w/bash too #/bin/bash--but i dont use bash)

Posted by Patrick on Feb. 18 2005,14:22
PEER1="members.chello.nl"
PEER1UPASS="bbbbb"
FILENAME="~/dsl.png"

my host = members.chello.nl
username = aaaaa
password = bbbbb

how do i run the script? (i called it ftpup)
where do i insert my username? (for the ftp-site)

Posted by mikshaw on Feb. 18 2005,14:59
You may want to read the ftp manpage, since tronic's script makes some assumptions about your knowledge, and is also slightly broken (unterminated function).

username and password are both entered with the PEER1UPASS variable PEER1UPASS="username password".

also i don't think the filename "~/dsl.png" will work, since the variable uses the same filename for both local and remote.  If you are in ~/ when you run the prog you can just use "dsl.png"

Posted by tronik on Feb. 18 2005,19:38
Ah...well my script is fine...but there is no }
;\
I think i wrote it when i woke up early this morning?

And PEER1UP works if you're calling the ftp with the username you'll be accessing on remote system otherwise, make it PEER1UPASS="user password"


Just add an } at the end of the file.

You call the script with /bin/sh script or you can chmod u+x script and then run it from the cwd as  ./script

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.