accepted = $accepted; $list = split(PATH_SEPARATOR, $path); if (count($list) <= 1) { parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path))); } else { $it = new AppendIterator(); foreach($list as $path) { $it->append(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path))); } parent::__construct($it); } } /** @return whether the current file has an image extension we want to keep */ function accept() { return in_array(pathinfo($this->current(), PATHINFO_EXTENSION), $this->accepted); } } $path = $argv[1]; $lightroom_database = $argv[2]; $db = new PDO('sqlite:' . $lightroom_database); echo "Photos se trouvant sur le disque mais pas dans le catalogue Lightroom\n"; $total_bytes = $counter = 0; $delete_commands = ''; foreach (new FindFile($path, $conf_accept) as $file) { if ($db->query('select count(*) from Adobe_imageFiles where absolutePath=' . $db->quote($file))->fetchColumn() == 0) { $counter++; $total_bytes += filesize($file); echo " $file\n"; $delete_commands .= "unlink $file\n"; } } echo "Vous pourriez récupérer " . number_format($total_bytes, 0, ',', ' ') . " octets d'espace disque sur $counter fichiers\n"; echo "\nExecutez les commandes suivantes pour supprimer les photos\n"; echo $delete_commands;