Created checkExist function for files and directories

This commit is contained in:
Asif Bacchus 2018-09-19 16:45:37 -06:00
parent 8d50f424c6
commit 5d33f5877e

View File

@ -39,6 +39,36 @@ function quit {
fi fi
} }
function checkExist {
if [ "$1" = "ff" ]; then
# find file
if [ -e "$2" ]; then
# found
echo -e "${normal}${stamp} File found: ${yellow}${2}${normal}" \
>> $logFileVerbose
return 0
else
# not found
echo -e "${red}${stamp} File NOT found: ${yellow}${2}${normal}" \
>> $logFileVerbose
return 1
fi
elif [ "$1" = "fd" ]; then
# find directory
if [ -d "$2" ]; then
# found
echo -e "${normal}${stamp} Dir found: ${yellow}${2}${normal}" \
>> $logFileVerbose
return 0
else
# not found
echo -e "${red}${stamp} Dir NOT found: ${yellow}${2}${normal}" \
>> $logFileVerbose
return 1
fi
fi
}
### End of Functions ### ### End of Functions ###