LoginSignup
2
2

More than 5 years have passed since last update.

perlでAzureのBlob操作(フォルダアップ)

Posted at

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

ファイル単位でチェックする場合などに。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2