Is there anyway that if the files doesn’t exists also I can do ftp and How do I make sure whether the files really existing there are not and the actual size of the source files
I want to ftp after checking the size of the files at the remote site
Since couple of days I am seeing the size of the files as 0 bytes
Iam using this code to check the ftp was successful or not.
and in the FTP LOGS
it says the transfer completed successfully but the bytes received are only 350 and 357 for two files instead of huge size (previously the size was 461868 bytes )
# Check if ftp was successful
#############################
failchk=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep failed | wc -l | tr -d " "`
denychk=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep denied | wc -l | tr -d " "`
abortchk=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep aborted | wc -l | tr -d " "`
codechk=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep ^[4-9] | egrep -v 'sent|received' | wc -l | tr -d " "`
connectchk=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep "Not connected" | wc -l | tr -d " "`
errchk=`expr ${failchk} + ${denychk} + ${abortchk} + ${codechk} + ${connectchk}`
#faildetail=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep failed`
#denydetail=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep denied`
#abortdetail=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep aborted`
codedetail=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep ^[4-9] | egrep -v 'sent|received'`
#connectdetail=`cat ${TMPDIR}/${FTPSITE}.${MOVETYPE}.ftp.log | grep "Not connected"`
errchk=`expr ${failchk} + ${denychk} + ${abortchk} + ${codechk} + ${connectchk}`
if [ "${errchk}" -ne 0 ]
then
echo "***FAILED FTP at `date +%H:%M` ${FTPSITE},${file} ${errchk}-${codedetail}" >> ${FTPLOG}
echo "`date "${FORM}"` FAILED ftp of ${RDIR} files" >> ${BASELOG}
echo "***FAILED FTP at `date +%H:%M` ${FTPSITE},${file} ${errchk}-${codedetail}"
else
echo "`date +%H:%M` FTP ${FTPSITE},${file}" >> ${FTPLOG}
echo "`date "${FORM}"` Finished ftp of ${RDIR} files" >> ${BASELOG}
echo "`date "${FORM}"` Finished ftp of ${RDIR} files"
fi
done
### finishied checking
