In OpenStack Swift, object storage can simulate a hierarchical directory structure in containers by including a /
(forward slash) character in the object's name.
Let's upload a file (AMERICA/USA/Newyork.txt
) to the Continent
container using the following command:
# swift upload Continent AMERICA/USA/Newyork.txt
Now let's list the Continent
container, which has a few pseudo-hierarchical folders, using the following commands:
# swift list Continent AMERICA/USA/Newyork.txt ASIA/ASIA.txt ASIA/China/China.txt ASIA/INDIA/India.txt Australia/Australia.txt continent.txt
We can use /
as the delimiter parameter to limit the displayed results. We can also use the prefix parameter along with the delimiter parameter to view the objects in the pseudo-directory along with the pseudo-directories within it. The following are a couple of examples showing the use of these parameters:
# swift list Continent --delimiter / AMERICA/ ASIA/ Australia/ continent.txt # swift list...