The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: FTP problems
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-22-2009
reddybs reddybs is offline
Registered User
  
 

Join Date: Jan 2009
Location: Sriharikota-AP-India
Posts: 53
FTP problems

Hi All,

I am ftping to a windows box where i will be going to a specific directory and check whether file is existing or not. If file exists, get the file to my UNIX box else, say that file didn't exist and touch a new file in UNIX box.

Here is what i tried the code:
This is FTP script.
Code:
ftp  -n <<EOF
open windowsboxname
user  --> User credintials.
cd FTPT1
pwd
ls
#Somewhere over here i need to check the file existance. If true get the file else touch #a new file,
get $2 $1/"$2"
rename $2 Archive/`date '+%Y_%m_%d'`"_"$2
quit
EOF
$2 is the file.



I am not sure where to include the code in such a way that the new file will be created if file doesn't exist.

Thanks in advance.