Back to Top

Bash script to find the file exist under the specified path or not

Updated 12 years ago

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….

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home