This is simple script to find the file in linux whether it exist in the specified location or not
#!/bin/bash
echo -n Please Enter the File Name:
read filename
echo -n “Now, Enter the path to the file : ”
read filepath
if [ -r $filepath ]
then
if [ -f ${filepath}/${filename} ]
then
echo !! File ${filepath}/${filename} is Found!!
else
echo Sorry, File ${filepath}/${filename} is not found.
fi
else
echo Access Denied to the Directory $filepath
fi
save it and run….
Be the first to comment.