mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class DeleteBulkInvoiceFiles extends Command
|
|
{
|
|
protected $signature = 'delete:bulk-download-files';
|
|
|
|
protected $description = 'Delete all the bulk download files';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$directories = [
|
|
storage_path('app/bulk_invoice'),
|
|
storage_path('app/bulk_whiteform'),
|
|
];
|
|
|
|
foreach ($directories as $directory) {
|
|
$start = new Carbon();
|
|
$this->info(Carbon::now() . ' Start cleaning - ' . $directory);
|
|
|
|
if (File::isDirectory($directory)) {
|
|
File::cleanDirectory($directory);
|
|
$this->info('All files have been deleted.');
|
|
} else {
|
|
$this->info('Directory does not exist.');
|
|
}
|
|
|
|
$end = new Carbon();
|
|
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
|
|
|
$this->info(Carbon::now() . ' Process ended. ElapsedTime: ' . $elapsedTime);
|
|
}
|
|
}
|
|
}
|