Friday 25 September 2009

ftp files using shell script or windows batch file

How to ftp files using shell script or windows batch file?

The below script helps to ftp file from remote server to the local machine. You can ftp using the below script on unix and windows.

To ftp from windows

Save the below code to a file ftpfile.bat and execute the batch script. Change the directory path of the file, username, password and remote server name on the script.

@echo off
echo user oracle> ftpftp.dat
echo password>> ftpftp.dat
echo bin>> ftpftp.dat
echo cd /u01/oradata>>ftpftp.dat
echo lc I:\data>>ftpftp.dat
echo get fileabc.dmp>> ftpftp.dat
echo bye>> ftpftp.dat
ftp -n -s:ftpftp.dat

To ftp from Unix

Save the above code to a file ftpfile.sh and execute the script. Change the directory path of the file, username, password and remote server name on the script.

No comments: