Hi
I need to setup a script to ftp a file from one unix box to another. I have modified the.netrc file, thus I can ftp into another box without being prompted for password. The question I have is, how can I setup a script which would after ftp, will change a directory, issue the bin command, then issue the put command and then quit the ftp. Could anyone help?????
Thanks
Following is the script code that I got from a friend and it worked like a charm:
/usr/bin/ftp ftpsiteaddress <<EOI
verbose on
bin
cd <directoryname>
put <filename>
quit
EOI
Ali
You might also need to include a user name and password also.
/usr/bin/ftp ftpsiteaddress <<END
verbose on
bin
user username password
cd <directoryname>
put <filename>
mput <filename>
get <filename>
mget <filename>
bye
END
Also when you copy the above, ensure that there are no white-spaces after the END, otherwise you'll have errors.
Thanks for your help.
Ali
using the username and password in your script file will send them as clear text if security is an issue better to use them in .netrc for security issues
Agreed, however if the ftp is within the same subnet, or does not go outside the primpary firewall ( or DMZ ), you should not really have any troubles.
Hope I got that right, still learning the networking side of things.
Cameron
T H A N K S !!!
Your script is magic !!!
could someone tell me if the line in the script below for passing the username as clear text should be as follows. If my username is henrik and my password is celtic would the line be
user henrik celtic
Whewn I try this I am prompted for a password and even when I give the correct one it comes back with an error. I know the .netrc file is the way to go but I want to get the syntax of this command right. I have tried a few variations on this and used the man file but am still getting errors.
Any thoughts
Hi All,
I have a requirement to ftp first top 100 lines of the file. Please help me in getting top 100 lines without creating temporary file in remote server.
I really appreciate earliest reply.
Thanks in advance.
-Obed