patternseek/recycle

一个实用库,为脚本实现回收站/垃圾桶功能,以便更安全地递归删除目录。

0.1.3 2016-02-24 14:49 UTC

This package is auto-updated.

Last update: 2024-09-20 05:21:55 UTC


README

Scrutinizer Code Quality SensioLabsInsight

一个实用库,为脚本实现回收站/垃圾桶功能,以便更安全地递归“删除”目录。

用法示例

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