Skip to content

Instantly share code, notes, and snippets.

@dmitry-mukhin
Last active June 2, 2017 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitry-mukhin/4684fac584bfa9db5a13 to your computer and use it in GitHub Desktop.
Save dmitry-mukhin/4684fac584bfa9db5a13 to your computer and use it in GitHub Desktop.
<?php
define('UC_PUBLIC_KEY', 'demopublickey');
define('UC_SECRET_KEY', 'demoprivatekey');
require_once 'vendor/autoload.php';
use \Uploadcare;
$api = new Uploadcare\Api(UC_PUBLIC_KEY, UC_SECRET_KEY);
$good_files = array(
'https://ucarecdn.com/00000000-1111-2222-3333-444444444444/',
'https://ucarecdn.com/55555555-6666-7777-8888-999999999999/'
);
foreach ($api->getFileList(array('stored' => true, 'to'=> '-14 days')) as $file) {
print $file . " " . $file->data['datetime_uploaded'] . "\n";
if (in_array($file->getUrl(), $good_files)) {
print $file->getUrl() . " is GOOD\n";
} else {
print $file->getUrl() . " is BAD, deleting\n";
$file->delete();
}
}
?>
@dmitry-mukhin
Copy link
Author

this needs to be updated for batch delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment