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
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 03:31 PM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 03:06 AM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 10:15 AM
returning to the parent shell after invoking a script within a script gurukottur Shell Programming and Scripting 5 09-26-2006 07:05 AM
return valuse from child script to parent script borncrazy Shell Programming and Scripting 1 08-20-2004 03:39 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-16-2005
cass4409 cass4409 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 4
Unhappy FTP script

Hi All,
Is there any command in FTP to concatenate the filename with current day and ftp this file from computer1 to computer2?

Example: Current day, 16/12/2005 (dd/mm/yyyy)

ftp abc16 ------------> abc16
Computer1 Computer2

Thanks For Your Time And Help.
  #2 (permalink)  
Old 12-16-2005
Bab00shka Bab00shka is offline
Registered User
  
 

Join Date: Apr 2002
Location: Chesterfield, UK
Posts: 123
Hi Cass,

YOu would need two seperate commands.

The concatenation would have to be done using Unix commands before you ftp the file over.

Hope this helps
Helen
  #3 (permalink)  
Old 12-16-2005
Just Ice's Avatar
Just Ice Just Ice is offline Forum Advisor  
Lights on, brain off.
  
 

Join Date: Mar 2005
Location: in front of my computer
Posts: 637
or you can rename the file as you put it into the remote server ...

put localfile localfile_and_date
  #4 (permalink)  
Old 12-18-2005
cass4409 cass4409 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 4
Thanks everyone for your replies. The problem is I need this particular file from Computer1 and it's in running sequence using the day, eg. abc12 (12th). My ftp script needs to extract this file directly from Computer2 without having to run any script in Computer1.
  #5 (permalink)  
Old 12-18-2005
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
How about if you get a directory listing of the remote server (ls -l or dir for example) and write it to a local temp file. Exit ftp, sort the output to put the newest line at the end, tail -1 and strip out the file name, then start up a second ftp session and retrieve the file?

Don't know what ftp program you're using though so can't help with building a script.

Carl
  #6 (permalink)  
Old 12-18-2005
cass4409 cass4409 is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 4
Hi BOFH,
I'm using .netrc to do an automated ftp transfer:

ftp -i <IP Address>

.netrc
default login <username> password <password>
macdef init
cd <directory>
binary
get <filename>
quit

I've actually thought of ftp-ing the files using the names found in the temp file but I'm clueless on how to go about writing this script. Can you show me the ways of doing it? Thanks.
  #7 (permalink)  
Old 12-19-2005
BOFH BOFH is offline Forum Advisor  
Registered User
  
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 406
Quote:
Originally Posted by cass4409
Hi BOFH,
I'm using .netrc to do an automated ftp transfer:

ftp -i <IP Address>

.netrc
default login <username> password <password>
macdef init
cd <directory>
binary
get <filename>
quit

I've actually thought of ftp-ing the files using the names found in the temp file but I'm clueless on how to go about writing this script. Can you show me the ways of doing it? Thanks.
What's the output of the temp file? Are there a bunch of files? Maybe you could just mget them all and sort it out after it's downloaded.

Carl
Closed Thread

Bookmarks

Tags
automated login, ftp, unix commands

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 08:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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