1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 10:19:24 +02:00
Oinktube/install/deleteTGZFiles.php
Caleb Mazalevskis 27a7925b98
Refactor.
2022-01-06 21:44:29 +08:00

25 lines
680 B
PHP

<?php
//streamer config
require_once '../videos/configuration.php';
ob_end_flush();
if (!isCommandLineInterface()) {
return die('Command Line only');
}
$path = getVideosDir();
$files = array_diff(scandir($path), ['.', '..']);
foreach ($files as $value) {
$dir = "{$path}{$value}";
if (is_dir($dir)) {
$files2 = array_diff(scandir($dir), ['.', '..']);
foreach ($files2 as $value2) {
$ext = pathinfo($value2, PATHINFO_EXTENSION);
if ($ext=='tgz') {
$file = "{$dir}/{$value2}";
echo $file.' '. humanFileSize(filesize($file)).PHP_EOL;
unlink($file);
}
}
}
}