PHP code example of patternseek / recycle

1. Go to this page and download the library: Download patternseek/recycle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

patternseek / recycle example snippets


// Recycle will attempt to create the directory, but not its parent.
$r = new Recycle( "/tmp/my_apps_recycle_bin/" );

// moveToBin tells you the new filepath/name for the moved
// file or directory. This is mostly useful for testing.
$movedTo = $r->moveToBin("/var/tmp/somefile_or_dir");

// Remove entries before last midnight
$r->emptyBin( $daysToKeep = 1 );