Jul 24, 2010
Delete Directory in PHP
This post will be helpful to those who work with directories and files.
I am writing here the PHP code for deleting the directory.
<?php
$extract_dir = 'path'; //physical path of the directory
if(deleteDirectory($extract_dir)) //delete directory
{
$msg = "$extract_dir was deleted";
echo $msg."<br/>";
}
else
{
$msg = "$extract_dir was not deleted";
echo...
read more
Feb 10, 2010
Page Redirect
I have written a script for getting the files list from directory and redirecting the page on selecting option from the select box.
So you will get the script for fetching all the files from current directory and redirecting page on selection.
<h>Please select option</h>
<?php
$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']; //current directory physical path
$dir_handle =...
read more
Jan 20, 2010
Copy Directory
I am listing here the method to copy full Directories with all sub-directories and files.
<?php
$source = 'f1'; //folder name
$target = 'f2'; //folder name , if target folder does not exists, it will be created
//echo 'src->'.$source.'<br/>';
//echo 'tar->'.$target.'<br/>';
if(is_dir($source))
{
full_copy($source,$target);
echo 'Folder copied';
}
else
{
echo 'Not copied';
}
function...
read more
