Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Unix script question
I am looking to resolve an issue we have with a particular script.
using a unix script, I need to determine if a file exists and if the size of the file is zero bytes. using ftp, we put a file a file on a server then we use get to retreive the same file back. we do this to ensure that the file has been sent successfully. once the file is gotten back, using get, we compare the original file to the get file. we then use if to see if the file was successfully send and received back. if the file is not gotten back, we email the necessary people of the error. if the files are different sizes, we email the necessary people that the file sizes do not match and that the ftp process needs to be done again. all of the above steps work fine.
the issue we face is when we ftp a zero byte file and receive the same file back the if statement we're using sees the zero byte file as none existant and therefore an email is sent saying that the ftp process failed when in fact it didn't. it just sent and received a zero byte file. a zero byte file is not a failed process.
finally...the question...
can a unix scripting guru assist me in the code that checks if a file is a zero byte file?
thanks in advance...Roy
below is the current portion of the script that checks for errors:
put file1 'file1'
get 'file1' check_file
bye
!EOF
# First if statement will check to see if the check file exists
if test ! -s "check_file"
then
# if the file does not exist, send the failed message and exit the program
echo Failed to pull a check file back from the FTP echodo /usr/ucb/mail -s ftp_of_file1.FAILED `cat $EMAIL/fail.list` < Received on Wed Jan 31 2001 - 13:46:03 CST
![]() |
![]() |