function deleteFiles($dir = NULL, $files = NULL) { if ($dir == NULL || $files == NULL || count($files) <= 0) { return FALSE; } global $cfg; $root = $cfg['path']['root']; $thumbRoot = $cfg['path']['thumb']; $bucket = $cfg['as3']['bucket']; $as3 = new AmazonS3Manager($cfg['as3']['key'], $cfg['as3']['secret']); // Loop through files and delete them foreach ($files as $file) { $path = _clean($root . '/' . $dir . '/' . $file); $as3->DeleteFile($bucket, $path); $thumbPath = _clean($thumbRoot . '/' . $dir . '/' . $file . '.jpg'); $as3->DeleteFile($bucket, $thumbPath); } }