Copy File From Azure Fileshare into Azure Blob over Byte Data Using Python
Pada posting berjudul "Copy File From Azure Fileshare into Azure Blob over Byte Data" ini akan saya berikan sample cara melakukan copy file secara langsung dari Azure Filehare ke Azure Blob menggunakan script python.
Dibawah ini contoh script-nya :
from azure.storage.blob import BlockBlobService
from azure.storage.file import FileService
from azure.storage.file import ContentSettings
ACCOUNT_NAME = 'accname'
ACCOUNT_KEY = 'acckey'
BBS = BlockBlobService(account_name = ACCOUNT_NAME, account_key = ACCOUNT_KEY)
FS = FileService(account_name = ACCOUNT_NAME, account_key = ACCOUNT_KEY)
fileshare_name = 'fs'
folder = 'folder_1/sub_folder_2'
filename = 'file_sample_source.JPG'
content_data= FS.get_file_to_bytes(fileshare_name, folder, filename, start_range=None, end_range=None, progress_callback=None, max_connections=2, timeout=None)
container_name = 'cn'
filename = 'folder_1/sub_folder2/file_sampl_result.JPG'
BBS.create_blob_from_bytes(container_name, filename, content_data, content_settings=None, max_connections=2, timeout=None)
Semoga posting tentang "Copy File From Azure Fileshare into Azure Blob over Byte Data" diatas dapat bermanfaat.
Salam