Skip to content

Instantly share code, notes, and snippets.

@yllus
Created June 4, 2015 19:29
Show Gist options
  • Select an option

  • Save yllus/91681a228676189bff42 to your computer and use it in GitHub Desktop.

Select an option

Save yllus/91681a228676189bff42 to your computer and use it in GitHub Desktop.
<?php
define('FOLDER_CLEANUP', '/Users/rdmdev/Downloads/temp');
$files = scandir(FOLDER_CLEANUP);
foreach ($files as $file) {
$wanted = explode("_", $file);
if (strpos($files[array_search($file, $files) + 6], $wanted[1]))
{
//unlink(FOLDER_CLEANUP . "/" . $file);
echo "Deleting: " . FOLDER_CLEANUP . "/" . $file . "\n";
}
}
echo "Done";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment