help(){
echo " This script checks for the employee files 'test_id001.dat' and delete the files with '*.dat' extension in the directory ${TEST_DIR}. Note : Make sure the TEST_DIR path is set as environment variable."
exit;
}
if [[ $1 = "-help" ]]
then
help
fi
cd ${TEST_DIR}
for file in *.rules
do
## Extract a substring to get the Employee Id from the File Name
## i.e Employeed Id 'id001' in the file test_id001.dat
employeeid="${file##*_}"
employeeid="${employeddid%.*}"
echo " = Remove the file for Employee with ID - $employeeid, file location = ${TEST_DIR}$file"
rm -f ${TEST_DIR}$file
done
echo " This script checks for the employee files 'test_id001.dat' and delete the files with '*.dat' extension in the directory ${TEST_DIR}. Note : Make sure the TEST_DIR path is set as environment variable."
exit;
}
if [[ $1 = "-help" ]]
then
help
fi
cd ${TEST_DIR}
for file in *.rules
do
## Extract a substring to get the Employee Id from the File Name
## i.e Employeed Id 'id001' in the file test_id001.dat
employeeid="${file##*_}"
employeeid="${employeddid%.*}"
echo " = Remove the file for Employee with ID - $employeeid, file location = ${TEST_DIR}$file"
rm -f ${TEST_DIR}$file
done
No comments:
Post a Comment