Although you cannot nest directories in OpenStack
Object Storage, you can simulate a hierarchical
structure within a single container by adding forward
slash characters (/) in the object
name. To navigate the pseudo-directory structure, you
may use the delimiter query parameter.
See the below examples for an illustration.
![]() | Note |
|---|---|
In the example below, the objects reside in a
container called |
Example 2.24. List Pseudo-Hierarchical Folders/Directories Request
To display a list of all the objects in the
storage container, use GET without a
delimiter or prefix.
GET /v1/AccountString/backups
The system returns status code 200 (OK) and the requested list of the objects.
photos/animals/cats/persian.jpg photos/animals/cats/siamese.jpg photos/animals/dogs/corgi.jpg photos/animals/dogs/poodle.jpg photos/animals/dogs/terrier.jpg photos/me.jpg photos/plants/fern.jpg photos/plants/rose.jpg
Use
the delimiter parameter to limit the displayed
results. Any character may be used as a delimiter.
However, to use delimiter with
pseudo-directories, use the parameter slash
(/).
GET /v1/AccountString/backups?delimiter=/
The system returns status code 200 (OK) and the
requested matching objects. Because we use the
slash, only the pseudo-directory
photos/ displays. Keep in mind
that the returned values from a slash
delimiter query are not real
objects. They have a content-type of
application/directory and are in a subdir section
of json and xml results.
photos/
Use the prefix parameter with the
delimiter parameter to view the
objects inside a pseudo-directory, including
further nested pseudo-directories.
GET /v1/AccountString/backups?prefix=photos/&delimiter=/
The system returns status code 200 (OK) and the objects and pseudo-directories within the top level pseudo-directory.
photos/animals/ photos/me.jpg photos/plants/
There is no limit to the amount of nested
pseudo-directories you can create. In order to
navigate through them, use a longer
prefix parameter coupled with the
delimiter parameter. In the
sample output below, there is a pseudo-directory
called dogs within the
pseudo-directory animals. In order to
navigate directly to the files contained within
dogs, enter the below command.
GET /v1/AccountString/backups?prefix=photos/animals/dogs/&delimiter=/
The system returns status code 200 (OK) and the objects and pseudo-directories within the nested pseudo-directory.
photos/animals/dogs/corgi.jpg photos/animals/dogs/poodle.jpg photos/animals/dogs/terrier.jpg

![[Note]](../common/images/admon/note.png)
