Created
August 18, 2016 17:48
-
-
Save elibixby/2fefe460e0db957763093bbceb78106d to your computer and use it in GitHub Desktop.
gcloud storage delete files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def delete_tmp_files(credentials, tmp_dir): | |
logging.info('Deleting temporary files') | |
parsed = urlparse.urlparse(tmp_dir) | |
client = storage.Client(credentials=credentials) | |
bucket = client.bucket(parsed.netloc) | |
batch = client.batch() | |
bucket.delete_blobs(bucket.list_blobs(prefix=parsed.path), | |
client=batch) | |
batch.finish() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment