Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Wednesday, 22 February 2012

Write a script to find the global complete path for any file.


clear
echo "Enter file name : "
read filename
str=`find . -name $filename`
if [ "$str" == "" ];then
    echo "File not found"
    exit 1
fi
path=`pwd`
len=`echo $str | wc -c`
str=`echo $str | cut -d "." -f 2-3`
echo "Full path of file is $path$str"

No comments:

Post a Comment