Space for google add

Write a menu driven program to perform various file operations.

  


Write a menu driven program to perform various file operations.

1. Display size of file

2. Display Last Access, changed, modified time of file

3. Display details about owner and user of File

4. Display type of file

5. Delete a file

6. Copy a file

7. Traverse a directory in hierarchy

8. Remove a directory


a3setc1.html

<html>

<form action="a3setc1.php" method="post">

Enter 1st file name<input type="text" name="file" value=""><br>

Enter 2nd file name<input type="text" name="file1" value=""><br>

Enter directory name<input type="text" name="dir" value=""><br>

<input type="radio" name="b" value="1">1.DISPLAY SIZE OF FILE<br>

<input type="radio" name="b" value="2">2.DISPLAY LAST ACCESSED,CHANGED,MODIFIED TIME OF FILE<br>

<input type="radio" name="b" value="3">3.DISPLAY DETAILS ABOUT OWNER AND USER OF FILE<br>

<input type="radio" name="b" value="4">4.DISPLAY TYPE OF FILE<br>

<input type="radio" name="b" value="5">5.COPY A FILE<br>

<input type="radio" name="b" value="6">6.TRAVERSE A DIRECTORY<br>

<input type="submit" name="submit" value="submit"><br>

</form>

</html>


a3setc1.php

<?php

$file=$_POST['file'];

$file1=$_POST['file1'];

$dir=$_POST['dir'];

$c=$_POST['b'];

$db=opendir($dir);

switch($c)

    {

case 1 :

$size=filesize("$file");

echo "the size of file is:$size";

break;

case 2:

$a=fileatime($file);

echo "last accessed time of file  is :$a<br>";

$c=filectime($file);

echo "last changed time of file $c";

$m=filemtime($file);

echo "last modified time of file $m";

break;

case 3:

$o=fileowner($file);

echo "owner  of file is $o";

break;

case 4:

$t=filetype($file);

echo "type of file is :$t";

                break;

        case 5:

                copy("$file","$file1");

                echo"copy successfully";

                break;

        case 6:

               while($a=readdir($db))

               {

                 echo"$a<br>";

               }

               break;

      default:"invalid choice";

}

?>



Post a Comment

0 Comments