Hi All,
I have txt file which has list of files. I have to check whether these files exist or not.
Thanks
supriya
Hi All,
I have txt file which has list of files. I have to check whether these files exist or not.
Thanks
supriya
Read the txt file and traverse through the file using for loop and attach this condition for existence of the file.
if [ -r filename ]; then
Can you please provide me the full code plz for reading and traversing also as i am failing over there
Thanks
Supriya
Please try it out yourself its not so difficult.
And if still not successful I give it
for i in $1
do
if [ ! -f $i ]; then
let countValue=1
fi
done
This is the code i am using and it is not working. where $1 is my txt file name
Thanks
Supriya
sample code
TESTBOX>
ip=$1
for i in `cat "$ip"`
do
if [ -r $i ]; then
echo "file $i exists"
else
echo "file $i doe n't exists"
fi
done
Thanks. It worked