Virtual Folders

Virtual folders

Inside each bucket in Object Storage, the file structure is not nested (sometimes referred to as a flat storage structure). However, virtual folders can be created inside buckets to mimic directories on a traditional file system. This allows you to write code for Object Storage that fetches the content into a nested structure more easily, as well as allowing third-party applications to simulate nested folders when browsing content inside a bucket. This also changes the display of CDN-published content in the browser. For example, if you want to subdivide objects inside a bucket named images into virtual folders for trees and cacti, then the object names inside the bucket would be formatted as:



When this content is then published to CDN, where each bucket is mapped to a unique subdomain, the virtual folders appear in the URL just like normal directories:

Virtual folders also enable you to create navigable directories on static websites. For example, creating an HTML file named trees/index.html in a bucket set to act as a static website allows a visitor to navigate to to view that page.


Object Storage permits spaces in bucket and object names, but this requires special HTML encoding to be honored when working with URLs in browsers or cURL commands. You can plan ahead to make your applications integrate more smoothly by using dashes (local-trees) or underscores (southwest_cacti) and generally creating bucket and object names out of UTF-8 compatible text characters.

When to use virtual folders

Virtual folders are best for organizing slow growth content that is closely grouped with the other objects in the bucket. We recommend slow growth because virtual folders alleviate neither performance issues nor most of the automation challenges presented by extremely high object counts–this can only be accomplished by spreading objects across multiple buckets. We recommend the content be closely grouped with everything else in the bucket because virtual folders exist only in Object Storage as the beginning text of an object’s name and do not contain any properties that objects inherit, such as metadata or TTL for CDN publishing.

Related Content