![]() |
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 |
| Does not exist or unreadable error in windows ftp script | rechever | Shell Programming and Scripting | 3 | 07-21-2009 12:10 AM |
| Check file and if it doesnt exist , exit script | tententen | Shell Programming and Scripting | 10 | 07-17-2009 01:36 AM |
| Expect Script - While file exist | skal5 | UNIX for Dummies Questions & Answers | 5 | 01-19-2009 12:30 PM |
| Need Script to check file exist and compare | rbknisely | UNIX for Dummies Questions & Answers | 1 | 01-16-2008 01:08 AM |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
file does not exist or unreadable in an FTP script
I will appreciate any help with this...
I have a file in this directory that looks like: this 07210900.SUP, I am getting the following error: Activities for Tue Jul 21 07:29:14 EDT 2009: File 07210900.SUP does not exist or unreadable End of activities The idea is to capture the file in the CDRemoteDir then change the name to a new name and then ftp to a unix directory. the XXXX is me changing some code (security reasons) CDRemoteDir='cd orgs/"Financial Aid"/"MIIS"/"0910"/"FTP" '; ScriptName="miis_ftp.ELM_SUP.shl"; UpLoadFileName=`date "+%m%d%y"00.SUP`; NewName= "eluppdtop.dat" ; Here is the all script Code:
MPATH=$BANNER_HOME; JOBNUM=$ONE_UP; USER=$BANUID; LPATH="/u02/sct/banjobs/"; RemoteHost="files.xxxxxxx.edu"; ### look at this RemoteUser="xxxx_xxxxx"; RemotePass="xxxxxxx"; CDRemoteDir='cd orgs/"Financial Aid"/"MIIS"/"0910"/"FTP" '; ScriptName="miis_ftp.ELM_SUP.shl"; UpLoadFileName=`date "+%m%d%y"00.SUP`; NewName= "eluppdtop.dat" ; TMode="ascii"; # Transfer mode EmailAddress="xxxxxxi@hhhhhh.edu"; LogFileName="miis_ftp.ELM_SUP_${USER}_${JOBNUM}.log"; LogFile="${LPATH}${LogFileName}"; TodayDate=`date`; echo "\nActivities for "$TodayDate":" >> $LogFile; #========================================================================# # 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 echo "End of activities\n" >> $LogFile # Exit the program since error occurred exit 1; } #========================================================================# # Change the directory to one contains the file to be transported ##cd $LocalDir; cd $CDRemoteDir; # Do an -r command on the desired file ensure that the file exist and readable if [ ! -r $UpLoadFileName ] then type="1"; ErrorHandle; fi # Do an -s command on the desired file ensure that the file exist # and is not null if [ ! -s $UpLoadFileName ] then type="2"; ErrorHandle; fi #========================================================================# # 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 directory in host machine echo ${CDRemoteDir} # Change local directory in local machine echo lcd $LocalDir # Transfer original file name echo put $NewName # End ftp session echo quit ) | ftp -vin $RemoteHost >> $LogFile # End of FTP Process Last edited by vgersh99; 07-21-2009 at 09:22 AM.. Reason: fixed code tag |
|
|||||
|
Double posting not allowed, read the forum rules!
Thread closed continue here: FTP from Windows to UNIX |
![]() |
| Bookmarks |
| Tags |
| uni |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|