![]() |
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. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
FTP help
I need to FTP a file
from LocalDir= 'cd orgs /"Financial Aid"/"MSS"/"0910"/"FTP" '; to CDRemoteDir="/u02/sct/banjobs"; The file in th local directory is created like 07130900.SUP the .SUP is always there, but the 07130900 (change everyday with the date, look at the format 07130900, how I can add code in this script, so I know that everyday is going to FTP the last file with the .SUP EXTENSION Code:
#! /bin/sh
#
#**************************************************************************
# Script: miis_ftp.ELM_SUP.shl
#
# Author:
# Date: 7/17/2009
#
# Purpose:
#
# files are downloaded from ELM,named xxxxxx00.SUP to
# ="/u02/sct/banjobs";
#
# Directory Location for script:
# #
# Special Notes: This shell script is called from XXX
# run in job submission
#
#
# Modifications:
# Date Author Description
#
#
#
#**************************************************************************
#
FILE_NAME="$1";
MPATH=$BANNER_HOME;
ScriptName="miis_ftp.ELM_SUP.shl";
UpLoadFileName1=${FILE_NAME};
LocalDir= 'cd orgs /"Financial Aid"/"MSS"/"0910"/"FTP" ';
RemoteHost="middfiles.xxxx.edu";
###look at this
RemoteUser="XXXXX_finance";
RemotePass="XXXXXX+";
CDRemoteDir="/u02/sct/banjobs";
TMode="ascii"; # Transfer mode
TodayDate=`date`;
echo "\nActivities for FTP proscess:";
#========================================================================================
# Change the directory to one contains the file to be transported
cd $LocalDir;
#----------------------------------------------------------------------------------------
# Initiate the FTP process
# Loop through remaining parameters to create ftp commands.
(
# Enter user-name and password in host machine
echo "user $RemoteUser $RemotePass"
# Set transfer mode
echo $TMode
# change remote directory
echo ${CDRemoteDir}
# Change local directory in local machine
##echo lcd $LocalDir
Last edited by vgersh99; 07-20-2009 at 12:14 PM.. Reason: code tags, PLEASE! |
| Bits Awarded / Charged to rechever for this Post | |||
| Date | User | Comment | Amount |
| 07-20-2009 | vgersh99 | added code tags - charged 3K bits | -3,000 |
|
||||
|
something like this?
Code:
ScriptName="miis_ftp.ELM_SUP.shl"; UpLoadFileName=`date "+%m%d%y"00.SUP`; NewName= "eluppdtop.dat" ; also will this work, knowing that the file is in a directory in windows.. It is going from a drirectory in windoxs to UNIX \ Code:
# Error Handling Function
function ErrorHandle
{
# if type is 1, then the file does not exist or unreadable
if [ $type -eq 1 ]
then
echo "File "$UpLoadFileName" does not exist or unreadable" >> $LogFile;
echo "Subject: Error in Running Script\n Error in uploading file script "$ScriptName". File "$UpLoadFileName" does not exist or unreadable" > EmailMessage;
sendmail -F " File Upload" $EmailAddress < EmailMessage;
rm EmailMessage;
fi
# if type is 2, then the file has zero size
if [ $type -eq 2 ]
then
echo "File "$UpLoadFileName" has a zero size value" >>$LogFile;
echo " Subject: Error in Running Script\n Error in uploading file script "$ScriptName". File "$UpLoadFileName" has a zero size value" > EmailMessage;
sendmail -F "The eluppdtop.dat File Upload" $EmailAddress < EmailMessage;
rm EmailMessage;
fi
Last edited by vgersh99; 07-20-2009 at 12:15 PM.. Reason: code tags, PLEASE! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|