Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: FTP command -without user interaction
Hi Bruce,
Thanks for you response. Yes it is Windows environment. I did follow exactly what you have mentioned in your mail, but i have problem in login.
Could you please let me where i'm going wrong?
D:\Oracle>type ftp_script.txt
open psrsndb2
oracle
temp123
cd sami
get 1.sql
quit
D:\Oracle>ftp -s:ftp_script.txt
ftp> open psrsndb2
Connected to psrsndb2.i2.com.
220 psrsndb2 FTP server (SunOS 5.8) ready.
User (psrsndb2.i2.com:(none)):
331 Password required for oracle .
530 Login incorrect.
Login failed.
ftp>
ftp> cd sami
530 Please login with USER and PASS.
ftp> get 1.sql
530 Please login with USER and PASS.
530 Please login with USER and PASS.
ftp> quit
221 Goodbye.
D:\Oracle>ftp psrsndb2
Connected to psrsndb2.i2.com.
220 psrsndb2 FTP server (SunOS 5.8) ready.
User (psrsndb2.i2.com:(none)): oracle
331 Password required for oracle.
Password:
230 User oracle logged in.
ftp> cd sami
250 CWD command successful.
ftp> get 1.sql
200 PORT command successful.
150 ASCII data connection for 1.sql (10.153.11.3,4723) (238 bytes).
226 ASCII Transfer complete.
ftp: 245 bytes received in 0.00Seconds 245000.00Kbytes/sec.
ftp> bye
221 Goodbye.
D:\Oracle>
"Reardon, Bruce (CALBBAY)" <Bruce.Reardon_at_co To malco.riotinto.co Multiple recipients of list m.au> ORACLE-L <ORACLE-L_at_fatcity.com> Sent by: cc ml-errors_at_fatcity .com Subject RE: FTP command -without user interaction 07/04/2003 11:59 AM Please respond to ORACLE-L_at_fatcity. com
What OS?
Since you say "batch" file I will presume Windows.
Use the "-s:filename" parameter and pass a scriptfile to the ftp command You can generate the scriptfile on the fly with echo commands and ">>" symbol redirection:
eg:
echo verbose off> %ftp_tfile%
echo open %ftp_tgt_node%>> %ftp_tfile%
echo %ftp_tgt_user%>> %ftp_tfile%
echo %ftp_tgt_pwd%>> %ftp_tfile%
echo type ascii>> %ftp_tfile%
echo cd %3>> %ftp_tfile%
echo put %1%2>> %ftp_tfile%
echo bye>> %ftp_tfile%
rem Do the actual ftp using this script file rem TYPE %ftp_tfile%ftp -s:%ftp_tfile%
Example:
C:\Temp>type ftpscript.ftp
open mynode
username
secretpassword
type ascii
cd sys$login
get login.com
bye
C:\Temp>ftp -s:ftpscript.ftp
ftp> open mynode
Connected to mynode.
220 mynode FTP Server (Version V4.1-12) Ready.
User (mynode:(none)):
331 Username USERNAME requires a Password.
230 User logged in.
ftp>
ftp> type ascii
200 TYPE set to ASCII.
ftp> cd sys$login
250 CWD command succesful.
ftp> get login.com
200 PORT command successful.
150 Opening data connection for login.com (a.b.c.d,2828)
226 Transfer complete.
ftp: 1570 bytes received in 0.20Seconds 7.85Kbytes/sec.
ftp> bye
221 Goodbye.
C:\Temp>
HTH,
Bruce Reardon
-----Original Message-----
Sent: Friday, 4 July 2003 4:09 PM
Hi All,
How to execute FTP command without interaction. Basically i want to supply hostname,username,passwors,filename thru batch script.
For example
ftp hostname userName passWord fileName
Could someone help me to do the same?
Thanks
Sami
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Reardon, Bruce (CALBBAY) INET: Bruce.Reardon_at_comalco.riotinto.com.au Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Fri Jul 04 2003 - 03:09:23 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: Saminathan_Seerangan_at_i2.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
![]() |
![]() |