count=0;
while read line;
do [[ -e "$line" ]] && let count=count+1; done < file_name.txt
echo
echo "$count of 10 files found "
echo
The scenario is a follows :
I have a file which contains a list of filenames present in particular directory .
I am checking fo the existence of the file and incrementing the counter by 1.
Now there are some files which are of a previous date ( but as the file name is same , it passes my check )
So what i plan to do is
store
ls -lrt file_name | awk {'print$7'}
in a varibale
store
date +'%d'
in a variable and compare both , if they dont match thn don't increment the counter .
You can touch .filename (it's name same as file name in the file_list) when you find the date change ,so
if you find filename older than .filename ,so ,it has changed.
if [ file1 -ot file2 ]
we can just think .filename is a timestamp file...