Skip to content

Instantly share code, notes, and snippets.

@bonprosoft
Created August 24, 2015 15:48
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 bonprosoft/353bd025a1bc99b338f1 to your computer and use it in GitHub Desktop.
Save bonprosoft/353bd025a1bc99b338f1 to your computer and use it in GitHub Desktop.
特定ディレクトリ以下のファイルをblobにアップロードするスクリプト
from azure.storage import BlobService
import os
import sys
BLOB_ACCOUNT = '[Input account name here]'
BLOB_ACCOUNTKEY = '[Input account key here]'
CONTAINER_NAME = '[Input container name here]'
TARGET_DIR = '[Input local data directory here]'
blob_service = BlobService(account_name=BLOB_ACCOUNT, account_key=BLOB_ACCOUNTKEY)
blob_service.create_container(CONTAINER_NAME)
for file in os.listdir(TARGET_DIR):
file_path = os.path.join(TARGET_DIR,file)
print "Uploading: %s" % file_path
blob_service.put_block_blob_from_path(
CONTAINER_NAME,
file,
file_path,
x_ms_blob_content_type='image/png'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment