modify('-3 day')->getTimestamp(); try { $files = $this ->xmlDump ->listContents('.') ->filter(fn (StorageAttributes $attributes) => $attributes->isFile() && $attributes->lastModified() < $maxDate) ->map(fn (StorageAttributes $attributes) => $attributes->path()) ->toArray(); } catch (FilesystemException $e) { $io->error($e->getMessage()); return Command::FAILURE; } foreach ($files as $file) { $this->xmlDump->delete($file); } $message = 'Removed '.count($files).' outdated XML dumps'; $this->logger->info($message); $io->success($message); return Command::SUCCESS; } }