I am new to shell scripting,and i was planning to write a script that will FTP files to destination folder.
I was planning that All configuration should be done through a properties files. and finally the output should be
Files are transferred
I have developed a properties file named ftp.properties and the content of this file are...
# these are the sample valus taken
135.23.34.212 userid password sourcefolder destfolder
135.23.34.212 is the remote ip and rest all is clear
I have also developed another main script file named ftp_script.sh which will read the properties file(ftp.properties)
contents are...
#!/bin/sh
while read line
do
RemoteIP=`echo $line | cut -d' ' -f1`
userid=`echo $line | cut -d' ' -f2`
passd=`echo $line | cut -d' ' -f3`
spath=`echo $line | cut -d' ' -f4`
dpath=`echo $line | cut -d' ' -f5`
ftp -vin >> ftp.log <<-!
open $RemoteIP
user $userid $passd
cd $dpath
lcd $spath
put $file
bye
!
done</your/ftp/properties/filepath/ftp.properties
Now I want to change the structure of my properties file(ftp.properties) in the below format...
#############################################
#Properties file for Ftp files
#############################################
#remote ip of the machine
RemoteIp=135.23.34.212
#This is the source directoy from where the files will be picked up
SrcFolders=/home/Administrator/files
#This directory path should end with a slash(/)
DestFolder=/home/Administrator/output/
#the pattern of the files
SourcefilePattern=*.xml
# your user id
userid=youruserid
#your password
password=yourpassword
Could you please guide me what should be the contents of main script file named ftp_script.sh ...as now there will be changes in
ftp_script.sh....!!
Hi,
so if I write the main script file which will read the properties file .. in this format itself ....
#############################################
#Properties file for Ftp files
#############################################
#remote ip of the machine
RemoteIp=135.23.34.212
#This is the source directoy from where the files will be picked up
SrcFolders=/home/Administrator/files
#This directory path should end with a slash(/)
DestFolder=/home/Administrator/output/
#the pattern of the files
SourcefilePattern=*.xml
# your user id
userid=youruserid
#your password
password=yourpassword
I was planning that my properties file instead of the remote ip should contain the url of the ftp server than in this process what changes would occur in my script file....please guide me ..!!