[[ METHOD 1 ]]
echo "Enter the file name"
read File_name
path=`pwd $File_name`
if [ -d $path/$File_name ] ; then
last_update=`ls -lt $File_name`
elif [ -f $path/$File_name ]; then
last_update=`ls -lt $File_name`
else
echo "File or Directory Not Found"
fi
echo $last_update
[[ METHOD 2 ]]
echo "Enter filename"
read filename
record=`ls -lt $filename`
mtime=`echo $record | cut -d " " -f 6-8`
if [ -f $filename ];then
echo "file exist and modification time is $mtime"
else
echo "file not exist"
fi
No comments:
Post a Comment