Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent "FTP and changing date"

Status
Not open for further replies.

dsm325

Technical User
Joined
Apr 4, 2001
Messages
29
Location
US
I need to write an ftp script that will get data from a folder with the currect date name. Of course the date changes every day.

Thanks in advance for your help
 
please send the format for a sample directory

i.e.

031102
03112002
Mar112002

Robert Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
Robert, first thanks for the quick reponse. Here is the format


03062002
 
#/usr/bin/ksh

# ftp server/login info
FTP_HOST='hostname' # ex:yahoo.com, ftp.microsoft.com
FTP_USER='username' # ex: joe
FTP_PASS='pass' # ex: password

CUR_DATE=`/usr/bin/date "+%m%d%Y"`

echo $CUR_DATE

# local directory
LOCAL_DIR=/something/here

# remote directory
REMOTE_DIR=/something/$CUR_DATE

# file
XMT_FILE=filename

# action - put or get
ACTION=get

echo $XMT_FILE

echo "get $REMOTE_DIR/$XMT_FILE $LOCAL_DIR/$XMT_FILE"

# connect via ftp
ftp -n $FTP_HOST<<END_SCRIPT
quote USER $FTP_USER
quote PASS $FTP_PASS
$ACTION $REMOTE_DIR/$XMT_FILE $LOCAL_DIR/$XMT_FILE
quit
END_SCRIPT
Robert G. Jordan

Robert@JORDAN2000.com
Unix Sys Admin
Chicago, Illinois U.S.A.
[lightsaber]
 
Robert, what if the date is yesterday's date not current date. Thanks again for your help and
 
Check out this great faq by Mike Lacey
for calculating yesterday's date.

Robert

faq80-953 Robert G. Jordan
Unix Sys Admin
Sleepy Hollow, Illinois U.S.A.

FREE Unix Scripts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top