Tuesday, June 21, 2011

Using ftp to transfer files in batch mode

bash-3.00# uname -a
SunOS vmxsun01 5.10 Generic_142910-17 i86pc i386 i86pc
bash-3.00#

bash-3.00# ftp -inv <<-EOD
> open localhost
> user oracle ora123
> cd ftproot
> binary
> mput test*.txt
> bye
> EOD
Connected to localhost.
220 vmxsun01 FTP server ready.
331 Password required for oracle.
230 User oracle logged in.
250 CWD command successful.
200 Type set to I.
200 PORT command successful.
150 Opening BINARY mode data connection for testa.txt.
226 Transfer complete.
200 PORT command successful.
150 Opening BINARY mode data connection for testb.txt.
226 Transfer complete.
200 PORT command successful.
150 Opening BINARY mode data connection for testc.txt.
226 Transfer complete.
200 PORT command successful.
150 Opening BINARY mode data connection for testd.txt.
226 Transfer complete.
221-You have transferred 0 bytes in 4 files.
221-Total traffic for this session was 845 bytes in 4 transfers.
221-Thank you for using the FTP service on vmxsun01.
221 Goodbye.