Login   Register  
PHP Classes
elePHPant
Icontem

File: class_dir_examples.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of MARY Matthieu  >  Files_DirectoryListing  >  class_dir_examples.php  >  Download  
File: class_dir_examples.php
Role: Example script
Content type: text/plain
Description: test script
Class: Files_DirectoryListing
Browse directories and their files
Author: By
Last change:
Date: 10 years ago
Size: 1,155 bytes
 

Contents

Class file image Download
<?php
require_once "class_dir.php";
// create the dir object
$dir = new dir("c:\windows");
if (
$dir->DATA_errors_size()) print_r($dir->DATA_errors());
// get ini and exe files in c:\windows
test($dir,"--e ini,exe");
// get all files exempt in c:\windows
test($dir,"--ne ini");
// get ini files in c:\windows and subfolders
test($dir,"--e ini --s");
// get all files exempt in c:\windows and subfolders
test($dir,"--ne ini --s");
// get all files with date of creation is 28 august 2001
test($dir,"--dc = 28082001");
// get the structure path in c:\windows
test_dir($dir,'--s');
// get all folders create the september 3 2003
test_dir($dir,'--s --dc = 03092003');

function 
test(&$dir,$sMsg)
{
    
title("search FILES with :[".$sMsg."]");
    
print_r($dir->LIST_files($sMsg));
}

function 
test_dir(&$dir,$sMsg)
{
    
title("search DIRECTORIES with :[".$sMsg."]");
    
print_r($dir->LIST_dir($sMsg));
}

function 
title($sMsg)
{
    echo 
"<BR>";
    echo 
"************************************************\r\n<BR>";
    echo 
$sMsg."\r\n<BR>";
    echo 
"************************************************\r\n<BR>";
}
?>