• Post Reply Bookmark Topic Watch Topic
  • New Topic

Non interactive FTP on LINUX  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All
I want to automate the ftp procedure so that I just it should not prompt me for user name and password ,but to accept the user name and password from some set of arguments or some scripts
Thanx in advance
Bye
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DOS/Windows version of the commandline ftp tool (yes, there is one...) allows the passing of a script file on the commandline which will be executed by the ftp program.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me give you a shell example. From this, you can see that you should merely use a Process object opened on the ftp executable. You write to the STDIN of the Process object (pardon me not rendering it in java-ese). This should work under windoze or linux.

[build@toothpick bin]$ cat f
quote user anonymous
quote pass some.email@foobar
verbose
binary
cd pub
quit
[build@toothpick bin]$ cat f | ftp -n ftp.redhat.com
Please login with USER and PASS.
Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Verbose mode on.
200 Switching to Binary mode.
250 Directory successfully changed.
221 Goodbye.
[build@toothpick bin]$
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!