checking textfile exists or not in all directories

Hai All,

please help me in solving this assignment!!!

i need a unix script that has to check the text file exists or not in all directories and sub directories if textfile exists display the directory path else display does not exists!!

example: kamal.txt that i want to search if the file exists are not in all the directories....

sh <scriptname.sh> <only-filename.txt> will be given by user while running....

please help me in solving this !!!

Thanks in advance...
kamal

try with find command.

i tried it!!! but i cannot find....
can u please write the code for me.... and posti it..

thanks in advance
kamal

Please post, whatever you have tried..

hi nua7,

first i am checking whether the textfile exists or not in all directories...
i have taken sample.txt file as example for input which exists in root directory..
this is the command that i have given: find / -path sample.txt -print
but output nothing was displayed
pls help me in solving this...

thanks in advance
kamal..

if [ $# -eq 1 ]
then
find / -name $1
else
echo "please provide a valid entry"
fi

if you want you can format the output as u want

Regards,