perl関連でAzureのBlobの操作の続き。
フォルダのアップについて。
Azureのtestコンテナの20140616フォルダ以下に、
ローカルの「/tmp/20140616」以下のフォルダやファイルをアップする。
upload.pl
#!/usr/bin/perl
use Net::Azure::StorageClient::Blob;
my $blobService = Net::Azure::StorageClient::Blob->new(
account_name => 'アカウント',
primary_access_key => 'シークレットキー', );
my $res = $blobService->upload('test/20140616/', '/tmp/20140616/');
if ( ( ref $res ) eq 'ARRAY' ) {
for my $obj ( @$res ) {
my $uri = $obj->base;
my $path = $uri->path;
my $meth = $obj->{ _request }->{ _method };
print $meth . ',' . $path . ',' . $obj->code . ',' . $obj->message . "\n";
}
}
出力結果は以下
PUT,/test/20140616/new/abc.txt,201,Created
PUT,/test/20140616/new/1/abcd.txt,201,Created
PUT,/test/20140616/new/2/abcde.txt.ts,201,Created
ファイル単位でチェックする場合などに。