ZasDataCleaner is a auto directory cleaner PHP class.
To utilize this class, first import ZasDataCleaner.php into your project, and require it.
require_once 'swap/ZasDataCleaner.php';
Simply create an instanace and start using it.
/**
* 'zas' is a folder name where the files are stored.
* '40%' always available space/storage.
* '120_GB' is the folder assigned storage limit.
*/
$cleaner = new ZasDataCleaner( 'zas', '40%', '120_GB' );
To get that how many files are in the folder:
$cleaner->file_count_in_folder();
If you set 40% then, how many files will be deleted?
$cleaner->delete_limit;
To check the assigned memory limit in 120_GB to bytes
:
$cleaner->assigned;
To check the folder memory size in bytes:
$cleaner->folder_size();
To display the available files in the folder array response
:
$cleaner->display_available_files();
Array
(
[0] => File (1).txt
[1] => File (2).txt
[2] => File (3).txt
)
This function always manage your folder with 40% cleaning:
$cleaner->delete_files();
Call the class for folder management:
require_once 'swap/ZasDataCleaner.php';
$cleaner = new ZasDataCleaner( 'zas', '40%', '120_GB' );
$cleaner->delete_files();