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
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 11-12-2008 09:12 PM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 10:17 PM
Have a shell script check for a file to exist before processing another file heprox Shell Programming and Scripting 3 11-14-2006 03:26 AM
Shell Script to Load data into the database using a .csv file and .ctl file Csmani Shell Programming and Scripting 3 05-24-2006 08:09 AM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 05:25 AM

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 11-17-2008
Manish4 Manish4 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 5
shell script to ftp a file

Hi

I would like to construct a UNIX shell script which when run, it will log on to an existing ftp server using a generic account and password, then list the files in a specific folder that begins with the string "abc" and particular date. The file names along with their creation date are then to be extracted on a csv file (or similar) to other server. Can any one be able to help me on this please?

thanks,
Manish
  #2 (permalink)  
Old 11-17-2008
sriharsha_kvr sriharsha_kvr is offline
Registered User
  
 

Join Date: Nov 2008
Location: Bangalore
Posts: 11
Try below script. Assign the appropriate values to the variables. mget fetches the multiple files with the specified condition.

#!/usr/bin/ksh

HOST='Your_Host_To_Connect'
USER='USER_ID'
PASSWD='PASSWORD'
DIRPATH=/home/manish/Files

echo "Fetching the requested data. Please wait..."

ftp -i -n $HOST <<EOF
user ${USER} ${PASSWD}
mget abc*
quit
EOF

echo "Done."
  #3 (permalink)  
Old 11-17-2008
sriharsha_kvr sriharsha_kvr is offline
Registered User
  
 

Join Date: Nov 2008
Location: Bangalore
Posts: 11
To print the results in a file, you may use the below command
ftp -i -n $HOST <<EOF > FileName
Sponsored Links
Closed Thread

Bookmarks

Tags
shell script, unix find

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:45 AM.


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