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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problems with cut scorpio Shell Programming and Scripting 6 04-28-2008 08:49 AM
NIS+ problems wjones UNIX for Advanced & Expert Users 0 04-09-2008 05:30 AM
RCP problems Daishi UNIX for Dummies Questions & Answers 0 09-10-2007 05:20 AM
gcc problems AJA SUN Solaris 7 03-09-2004 10:44 AM
'make' problems (compliation problems?) xyyz UNIX for Advanced & Expert Users 5 11-05-2001 10:47 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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.
  #2 (permalink)  
Old 04-22-2009
dennis.jacob dennis.jacob is offline Forum Advisor  
dj -------
  
 

Join Date: Feb 2007
Location: Cochin/Singapore
Posts: 515
One suggestion is to use two ftp sessions

- first one is used to just get the "ls" on the remote machine & check the existance of filename in the list and display if it not exists.
- second session will be executed only if the list generated in the first list contain the filename. then do the "get" of teh required files.
  #3 (permalink)  
Old 04-22-2009
reddybs reddybs is offline
Registered User
  
 

Join Date: Jan 2009
Location: Sriharikota-AP-India
Posts: 53
Quote:
Originally Posted by dennis.jacob View Post
One suggestion is to use two ftp sessions

- first one is used to just get the "ls" on the remote machine & check the existance of filename in the list and display if it not exists.
- second session will be executed only if the list generated in the first list contain the filename. then do the "get" of teh required files.

Many thanks for the reply. I will give it a try.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0