patternseek/recycle

A utility library implementing a recycle/trash bin for scripts to more safely recursively delete directories.

0.1.3 2016-02-24 14:49 UTC

This package is auto-updated.

Last update: 2024-04-20 04:18:24 UTC


README

Scrutinizer Code Quality SensioLabsInsight

A utility library implementing a recycle/trash bin for scripts to recursively 'delete' directories more safely.

Usage example

// 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 );