Wednesday, 8 July 2015

PR(1) Implementation of Create/Rename/Delete a File using Unix/Linux Command

Date of Performance : 01/07/2015

Date of Checking : 02/07/2015
*******************************************************************************
while true
do
echo "1.Create File";
echo "2.Rename File";
echo "3.Delete File";
echo "4.List Files";
echo "5.Exit";
echo "Enter your choice";
read ch;
case $ch in
1)
                echo "This is file create opration";
                echo "Please Enter file Name You want to be Create:-";
                read file;
                if [ -f $file ]
then
                echo "File already existing!!!";
else
                touch $file;
                echo "File created!";
                echo "Created file can be checked from following table";
                ls -t | head -n 15
fi
;;
2)
                echo "Enter file Name to be renamed";
                read file;
                echo "Enter New file Name";
                read newfile;
                if [ -f $file ]
                then
                mv $file $newfile;
                echo "File Renamed Successfully";
                echo "Created file can be checked from following table";
                ls -t | head -n 15
else
                echo "File Doesnot Exit";
fi
;;
3)
                echo "Enter file name to be deleted";
        read file;
                if [ -f $file ]
then
rm $file;
                echo "File Deleted successfully";
                echo "Deledted file can be checked from followin table";
                ls -t | head -n 15
else
                echo "File doesnot exit";
fi
;;

4)

                echo "List of first 20files sort by time";

                ls -t | head -n 15
;;

5)
exit;
;;

esac
done

No comments:

Post a Comment