download

Prev Next

Classic/VPC環境で利用できます。

コンテナ(バケット)のオブジェクトをダウンロードします。

構文

download構文は次の通りです。

  • アカウント(すべてのコンテナおよびオブジェクトのダウンロード)

    swift download \
        --all \
        [--marker <marker>] \
        [--prefix <prefix>] \
        [--remove-prefix] \
        [--output-dir <out-directory>] \
        [--object-threads <threads>] \
        [--container-threads <threads>] \
        [--no-download] \
        [--skip-identical] \
        [--ignore-checksum] \
        [--ignore-mtime] \
        [--no-shuffle] \
        [--header <header:value>]
    
  • コンテナ(コンテナ内のすべてのオブジェクトをダウンロード)

    swift download \
        <container> \
        [--marker <marker>] \
        [--prefix <prefix>] \
        [--remove-prefix] \
        [--output-dir <out-directory>] \
        [--object-threads <threads>] \
        [--container-threads <threads>] \
        [--no-download] \
        [--skip-identical] \
        [--ignore-checksum] \
        [--ignore-mtime] \
        [--no-shuffle] \
        [--header <header:value>]
    
  • オブジェクト(単一または複数のオブジェクトのダウンロード)

    swift download \
        <container> <object> [<object> ...] \
        [--output <out-file>] \
        [--output-dir <out-directory>] \
        [--object-threads <threads>] \
        [--no-download] \
        [--skip-identical] \
        [--ignore-checksum] \
        [--ignore-mtime] \
        [--header <header:value>]
    

オプション

downloadの実行時に指定できるオプションについて説明します。

必須オプション

downloadの必須オプションです。

オプション タイプ 必須の有無 説明
<container> String Conditional コンテナ名
  • --all未入力の場合、必ず入力
--all Boolean Conditional アカウント内のすべてのオブジェクトをダウンロード
  • <container>未入力の場合、必ず入力

任意オプション

downloadの任意オプションです。指定しない場合、オプションにはデフォルト値が適用されます。

オプション タイプ 必須の有無 説明
<object> List Optional オブジェクト名
  • スペースで区切って複数入力可能
  • 未入力の場合、コンテナ内のすべてのオブジェクトをダウンロード
--prefix String Optional 指定した接頭辞で始まる項目のみダウンロード
--remove-prefix Boolean Optional 接頭辞を除いた名前で保存
  • --prefixと併せて使用
--marker String Optional コンテナまたはアカウントのダウンロードを開始する基準となる位置
--output String Optional 単一ファイルのダウンロード時に保存するファイルのパス
  • -入力時、標準出力で渡す
--output-dir String Optional オブジェクトの保存先ディレクトリ
  • 未入力の場合、現在のディレクトリに保存
  • オブジェクトを1つだけ指定した場合は使用不可(--outputを使用)
--no-download Boolean Optional ダウンロードを行うが、ディスクには保存しない
--skip-identical Boolean Optional ローカルファイルとオブジェクトが同一の場合、ダウンロードしない
--ignore-checksum Boolean Optional ダウンロード時のチェックサム検証を無効化
--ignore-mtime Boolean Optional X-Object-Meta-Mtimeヘッダを無視して新しい時間情報で保存
--no-shuffle Boolean Optional オブジェクトストレージに並べられている順序でダウンロード
  • 未入力の場合、任意の順序でダウンロード
--object-threads Integer Optional オブジェクトのダウンロードに使用するスレッド数
  • デフォルト: 10
--container-threads Integer Optional コンテナのダウンロードに使用するスレッド数
  • デフォルト: 10
--header String Optional ダウンロードリクエストに使用するユーザー定義ヘッダ
  • header:value形式で入力
  • 複数回入力可能

共通オプション

swiftコマンドで共通して使用するオプションについては、Archive Storageのオプションをご参照ください。

例

コマンドを実行すると、ダウンロードしたオブジェクト名と所要時間情報が表示されます。

コマンド

1つのオブジェクトをダウンロードするコマンドの例は次の通りです。

swift download test-container-01 sample.txt

接頭辞で絞り込んで保存先ディレクトリを指定し、同一のファイルはスキップするコマンドの例は次の通りです。

swift download test-container-01 \
    --prefix docs/ \
    --output-dir ./download \
    --skip-identical

アカウント内のすべてのオブジェクトを順番にダウンロードするコマンドの例は次の通りです。

swift download \
    --all \
    --no-shuffle

出力

1つのオブジェクトをダウンロードする出力の例は次の通りです。

sample.txt [auth 0.000s, headers 0.109s, total 0.109s, 0.000 MB/s]

接頭辞で絞り込んでダウンロードする出力の例は次の通りです。

./download/docs/report.txt [auth 0.000s, headers 0.071s, total 0.071s, 0.000 MB/s]

アカウント内のすべてのオブジェクトをダウンロードする出力の例は次の通りです。

test-container-01/renamed.txt [auth 0.000s, headers 0.129s, total 0.129s, 0.000 MB/s]
test-container-01/sample.txt [auth 0.000s, headers 0.132s, total 0.132s, 0.000 MB/s]
test-container-01/large.bin [auth 0.000s, headers 0.236s, total 0.372s, 14.090 MB/s]