【问题标题】:swift list -p variable not settingswift list -p 变量未设置
【发布时间】:2016-08-10 17:30:58
【问题描述】:

我正在使用 swift CLI 并尝试从容器中下载多个对象。

我可以这样做

for i in `swift list container -p object/201505`; do swift download container $i; done

问题是我需要搜索和下载所有匹配的多个对象。我试过用一个小脚本来做。

#!/bin/bash

while read objects;
SAMPLE=$(swift list container objects);
do
for i in $SAMPLE; do `swift download container $i`; done
done < samples_list

但我总是收到以下问候。

Usage: swift [options] list [options] [container]
    Lists the containers for the account or the objects for a container. -p or
    --prefix is an option that will only list items beginning with that prefix.
    -d or --delimiter is option (for container listings only) that will roll up
    items with the given delimiter (see Cloud Files general documentation for
    what this means).

我的变量没有被读取吗?如何仅下载具有我设置的正确前缀的文件?

【问题讨论】:

    标签: bash openstack openstack-swift


    【解决方案1】:

    我真的不知道swift,但我想你想要

    #!/bin/bash
    
    while read objects; do
      swift list container "$objects" | while read i; do
        swift download container "$i"
      done
    done < samples_list
    

    我假设swift list 在其输出中每行写入一项。

    【讨论】:

    • 尊敬的先生,感谢您的快速响应。我已经编辑了脚本以反映您的更改,它给出了同样的错误。我会做一些必要的事情,并调查更多关于 openstack swift 的问题。
    猜你喜欢
    • 2017-09-17
    • 1970-01-01
    • 1970-01-01
    • 2021-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    相关资源
    最近更新 更多