How can i use FTP Command in a shell script ?
user='user1'
password='password1'
IP='***.***.***.***'
ftp -n $IP 22 <<END_SCRIPT
user $user $password
exit
END_SCRIPT
How can i use FTP Command in a shell script ?
user='user1'
password='password1'
IP='***.***.***.***'
ftp -n $IP 22 <<END_SCRIPT
user $user $password
exit
END_SCRIPT
See the .netrc
The best ways is to use "sftp"
If you have "ssh-key generation between the client and host server then sftp is the best option.
code :
sftp $servername <<END_SCRIPT
Your code
END_SCRIPT
If you know concept of key gen then use sftp. keygen establish a connection between 2 server by which u dont need userid and pwd for connection..
Try this
user='user1'
password='password1'
IP='***.***.***.***'
ftp -n -i -v $IP 22 <<-END_SCRIPT > LOG_file
user $user $password
status
bin
lcd <DESTINATION DIR>
cd <REMOTE DIR>
mget *.*
bye
END_SCRIPT
Regards,
Pankaj