![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| read list of filenames from text file and remove these files in multiple directories | fxvisions | Shell Programming and Scripting | 5 | 08-07-2008 04:59 PM |
| How can I rename multiple files depending on a string occuring in the filenames? | karman | UNIX for Dummies Questions & Answers | 6 | 05-22-2007 03:29 PM |
| Getting a list of filenames of moved files | chengwei | Shell Programming and Scripting | 3 | 04-23-2007 04:25 AM |
| Help in FTP'ing multiple files | berlin_germany | Shell Programming and Scripting | 10 | 12-01-2006 05:48 PM |
| Script to backup multiple files and amend their filenames | m223464 | Shell Programming and Scripting | 5 | 11-25-2005 06:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
FTP'ing files with filenames in mail messege
Hi,
I have created the following FTP script, which transfers daily “.txt” files from remote server in to a timestamped folder on local server. Once all files are FTP’ed, it then deletes files from remote server. When files are FTP’ed, I get a mail messege like, “Files are successfully transfered”, which I have hard-coded in “ftp_succ.msg” file. My problem is that I want to include names of FTP’ed files in this messege. Now, names of files FTP’ed can change everyday, so I can’t use a hard-coded pattern messege. Instead I want to be done that by FTP script itself. Can anybody please suggest me, how to do that? #################################################### # Set local variables #################################################### export DROPOFF=/temp1 export PICKUP=/temp2 export MSG=/temp1/ftp_messege export LOG=/temp1/ftp_log export LOGIN=username export FTPPASS=password export DEVICE=remoteserver #################################################### # FTP'ing files from remoteserver to localserver #################################################### cd $DROPOFF mkdir ftp`date '+%Y%m%d'` cd ftp`date '+%Y%m%d'` `ftp -vin <<- END_INPUT > $LOG/ftp_files.log 2>&1 open $DEVICE user $LOGIN $FTPPASS cd $PICKUP mget * .txt # mget *.* would get all files from current directory. # By default, prompting would be enabled; if you wish to get all files without being # prompted, use the "prompt" command to disable/enable prompting. mdelete * .txt quit END_INPUT` EXIT_STATUS=$? if [[ $EXIT_STATUS -ne 0 ]] then echo "[%s - %s]ERROR: FTP failed with an exit status of %s\n" \ %0 "$(date +'%x %X')" $EXIT_STATUS mailx -r xyz@localserver.annonymous.com -s \'"Files FTP failed'" user@annonymous.com < $MSG/ftp_fail.msg exit 1 fi #################################################### # Notifying successful FTP of files #################################################### mailx -r xyz@localserver.annonymous.com -s \'"Files FTP complete to localserver successfully'" user@annonymous.com < $MSG/ftp_succ.msg exit 0 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|