0
parameters=$#
#
#
#Error Conditions
Error=1
Success=0
if [ $parameters = 0 ] || [ $parameters  -lt 2 ]
then
   exit $Error
fi

# get the parameters
pattern=$1
filepath=$2

day=`date +%d`
month=`date +%m`
year=`date +%Y`
echo $day
echo $month
echo $year 

enddate=$year$month$day

echo $enddate
day1=01
month1=`date +%m`
year1=`date +%Y`
startdate=$year1$month1$day1
echo $startdate

cd $filepath
# check for the file 
# create the date variabe
DATE_DIR=`date +%Y%m%d_%H%M%S`

while [[ $startdate -le $enddate ]]
do  
test=`find . -maxdepth 2 -name $1`
if [ "$test" = "" ]
then
    echo 'files are found'  
        exit 0
else    
    echo 'files are not found'
        exit 1
fi 
done
terdon
  • 242,166
Mahe
  • 23
  • Can you show us the output of your efforts to handle this problem? – Paulo Tomé Feb 27 '20 at 10:49
  • Please find the below code. Here the filename (pattern) and path are provided at run time. – Mahe Feb 27 '20 at 10:56
  • Hi Paulo Tome, please have a look and let me know if I'm missing something – Mahe Feb 27 '20 at 11:10
  • Please use the formatting tools to format your code as code. Also, you need to ask a question. You are now just showing a script with no context and no indication of what you need. What does the script need to do? What is it actually doing? Does it work? How does it fail? Any error messages? – terdon Feb 27 '20 at 11:16

0 Answers0