PHP Classes

File: example_and_doc.php

Recommend this page to a friend!
  Classes of Carlos Sánchez   olDelete   example_and_doc.php   Download  
File: example_and_doc.php
Role: Example script
Content type: text/plain
Description: Example and documentation
Class: olDelete
Delete aged files and folders
Author: By
Last change:
Date: 14 years ago
Size: 869 bytes
 

Contents

Class file image Download
<?php
/* olDelete by vicius23 (Carlos Sánchez): DOCUMENTATION:
 *
 * Creation of the class: $myclass = new olDelete($path,$time);
 * $path = Full Path to the directory (you shoud use $_SERVER["DOCUMENT_ROOT"] to get to it ;) ).
 * $time = Number of Minutes that we want to specify to delete old files.
 * Usage:
 * $myclass->deleteFile(); --> Deletes all old files from the directory specified that are $time or more minutes old.
 * $myclass->deleteFolder(); --> Same as above, but with folders.
 *
 *
 * Example:
 */
 // Load class Navigator:
include_once("../classes/class.navigator.php"); //REQUIRED!!!!
 
$path=$_SERVER["DOCUMENT_ROOT"]."/myfolder/folder2/";
$time=2200;

//Create class:
$myclass=new olDelete($path,$time);

// Delete files:
$myclass->deleteFile();

// Delete Folders:
$myclass->deleteFolder();
?>