Created
August 24, 2015 15:48
-
-
Save bonprosoft/353bd025a1bc99b338f1 to your computer and use it in GitHub Desktop.
特定ディレクトリ以下のファイルをblobにアップロードするスクリプト
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
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