<?
// change this to your include path
require_once("$DOCUMENT_ROOT/include/class.folderbot.php");
// The three methods in this extended class override the base class methods which don't do much.
// That's basically how you use folderbot. You get the stuff which doesn't do much in the base class to work for you
class listfolder extends folderbot
{
// uncomment below to filter
/*
function is_match()
{
return strstr($this->curfile,".txt");
}
*/
// Triggered by the parent class, it is called every time a file matching the filter has been found
// in this example, it prints the file which is stored in a class variable called curfile.
function file_event()
{
print("File event-->$this->curfile<BR>\n");
}
// Called every time a folder is found. It just prints its name
function folder_event()
{
print("Folder event-->$this->curfile<BR>\n");
}
}
//here we go
$bot=new listfolder();
$bot->set_recurse(true); // set to false to only list the folder without subfolder.
$bot->scan("./"); // will scan wherever you have placed the example. make sure you have access permission there and below :)
?> |