メインコンテンツまでスキップ
Version: Fegg 5.x(開発版)

File::removeExpiredFile

Remove the files older than the specified minutes

Description​

public boolean File::removeExpiredFile( string $path, int $min )

Deletes the files directly under $path whose modification time is $min minutes ago or older. Subdirectories are not touched. The return value is always false.

Arguments​

NameData typeDefaultRemarks
$pathstringTarget directory
$minintAge in minutes after which a file is deleted

Example​

Controller
use Fegg\Tool\File;

$file = new File();

// Delete temporary files older than one day
$file->removeExpiredFile('path/to/tmp', 60 * 24);