How to Organize Files with Folders

Validated on 9 Apr 2019 • Last edited on 13 Apr 2026

Spaces Object Storage is an S3-compatible service for storing and serving large amounts of data. The built-in Spaces CDN minimizes page load times, improves performance, and reduces bandwidth and infrastructure costs.

Spaces uses folder-style navigation in the DigitalOcean Control Panel and in many third-party clients to help you organize files.

Note
Spaces doesn’t store folders as actual backend directories. Object storage is flat, so a folder appears when object names share a prefix that looks like a path. As a result, folders in Spaces don’t have their own permissions, metadata, or stored contents.

Create a Folder Using Automation

You can create a folder using S3-compatible tools or the Spaces API. Because Spaces uses flat object storage, creating a folder through automation means creating an object key prefix that ends with /.

Create a Folder via an S3-Compatible Tool

To create a folder, use an S3-compatible tool such as AWS CLI or s3cmd.

For example, you can create a zero-byte object whose key ends with / with AWS CLI:

aws s3api put-object --bucket <bucket-name> --key <folder-name>/ --endpoint-url https://<region>.digitaloceanspaces.com

Create a Folder via the API

To create a folder via the Spaces API, send a PUT request to the object endpoint using a key that ends with /. For more details, see the Spaces API reference.

Create a Folder Using the Control Panel

To create a folder for your bucket’s files, go to the control panel, in the left menu, click Spaces Object Storage, and then under the Buckets tab, click the bucket with the files you need to contain in folders.

In the bucket’s Files tab, in the right, click the Actions dropdown menu, and then click Create Folder.

In the Create a new folder window, in the New folder name field, enter the name for the folder. It must be a unique name that doesn’t currently exist in the bucket.

Afterwards, click Save.

Rename a Folder Using Automation

You can rename a folder using S3-compatible tools or the Spaces API. Because Spaces uses flat object storage, renaming a folder means copying all objects under the old prefix to a new prefix, and then deleting the original objects.

Rename a Folder via an S3-Compatible Tool

To rename a folder from the command line, use an S3-compatible tool such as AWS CLI or s3cmd.

For example, with AWS CLI, you can move all objects recursively:

aws s3 mv s3://<bucket-name>/<old-folder>/ s3://<bucket-name>/<new-folder>/ --recursive --endpoint-url https://<region>.digitaloceanspaces.com

With s3cmd:

s3cmd mv --recursive s3://<bucket-name>/<old-folder>/ s3://<bucket-name>/<new-folder>/

Rename a Folder via the API

To rename a folder via the API, list the objects under the old prefix, copy each object to the new prefix, and then delete the original objects. For more details, see the Spaces API reference.

Rename a Folder Using the Control Panel

To rename a folder, go to the control panel, in the left menu, click Spaces Object Storage, and then under the Buckets tab, click the bucket with the folder you want to rename.

Under the Files tab, select the folder you want to rename, in the right, click the dropdown list, and then click Rename to open the Rename window.

In the Rename field, enter the new name for the folder. It must be a unique name that doesn’t currently exist in the bucket.

Afterwards, click Save.

Move Files and Folders Using Automation

You can move files and folders using S3-compatible tools or the Spaces API. Because Spaces uses flat object storage, moving files or folders means changing their keys. This means moving or copying objects to a new prefix and deleting the originals.

Move Files and Folders via an S3-Compatible Tool

To move files or folders from the command line, use an S3-compatible tool such as AWS CLI or s3cmd.

For example, to move a single file with AWS CLI:

aws s3 mv s3://<bucket-name>/file.txt s3://<bucket-name>/<folder-name>/file.txt --endpoint-url https://<region>.digitaloceanspaces.com

With s3cmd:

s3cmd mv s3://<bucket-name>/file.txt s3://<bucket-name>/<folder-name>/file.txt

To move all objects under a folder-like prefix with AWS CLI:

aws s3 mv s3://<bucket-name>/<source-folder>/ s3://<bucket-name>/<target-folder>/ --recursive --endpoint-url https://<region>.digitaloceanspaces.com

With s3cmd:

s3cmd mv --recursive s3://<bucket-name>/<source-folder>/ s3://<bucket-name>/<target-folder>/

Move Files and Folders via the API

To move files or folders via the API, copy the object or objects to the new key or prefix, and then delete the originals. For more details, see the Spaces API reference.

Move Files and Folders into a Folder Using the Control Panel

Folders can contain files and nested folders.

Note
You can set permissions on the files inside a folder, but to apply permissions recursively to all files in a folder, you currently need to use a third-party client.

To move files or folders into a folder, go to the control panel, in the left menu, click Spaces Object Storage, and then under the Buckets tab, click the bucket with the files or folders you need to move.

Move a File or Folder

To move either a file or folder into a folder, on the right, click the file’s or folder’s dropdown list, and click Move to….

In the Move item window, either select an existing folder listed, or in the right, click Create new folder.

Then, click Move item.

Move Multiple Files or Folders

To move multiple files or folders, in the left, click the checkboxes of the files and folders you want to move.

In the right, click the new Actions dropdown used for executing an action for multiple files and folders, and then click Move To Folder.

In the Move item window, either select an existing folder listed, or in the right, click Create new folder.

Then, click Move item.

Filter Files Using Automation

You can filter files using S3-compatible tools or the Spaces API by listing objects under a prefix, and then applying additional filtering in your client or script.

Filter Files via an S3-Compatible Tool

To list objects under a prefix from the command line, use an S3-compatible tool such as AWS CLI or s3cmd.

For example, with AWS CLI:

aws s3api list-objects-v2 --bucket <bucket-name> --prefix <folder-name>/ --endpoint-url https://<region>.digitaloceanspaces.com

With s3cmd:

s3cmd ls s3://<bucket-name>/<folder-name>/

These commands return objects whose keys begin with the prefix you specify.

Filter Files via the API

To filter files via the API, send a ListObjectsV2 request with a prefix, and then apply any additional filtering in your application. For more details, see the Spaces API reference.

Filter Files in a Folder Using the Control Panel

To filter files in a folder, go to the control panel, in the left menu, click Spaces Object Storage, and then under the Buckets tab, click the bucket with the folder you need to filter files for.

Under the Files tab, click the folder you want filter, and then in the left, in the search field, type the words you want to use to filter the files. For example, enter the beginning of a file name to narrow the list of files shown.

The filter matches items that begin with the text you enter. This helps you find items quickly without scrolling through long lists.

The filter applies only to files and folders shown at the current level. One exception is that, from the root of a Space, filtering by a complete file name can return that file in the results.

Delete Folders Using Automation

You can delete folders using S3-compatible tools or the Spaces API. Because Spaces uses flat object storage, deleting a folder means deleting all objects under that prefix.

Delete Folders via an S3-Compatible Tool

To delete a folder from the command line, use an S3-compatible tool such as AWS CLI or s3cmd.

For example, with AWS CLI:

aws s3 rm s3://<bucket-name>/<folder-name>/ --recursive --endpoint-url https://<region>.digitaloceanspaces.com

With s3cmd:

s3cmd del --recursive s3://<bucket-name>/<folder-name>/

Delete Folders via the API

To delete a folder via the API, list the objects under the prefix, and then delete those objects. For more details, see the Spaces API reference.

Delete Folders Using the Control Panel

Deleting a folder permanently deletes all files and subfolders inside it. This action cannot be undone, so before deleting a folder, move any files or folders you want to keep.

To delete a folder, go to the control panel, in the left menu, click Spaces Object Storage, and then under the Buckets tab, click the bucket with the folder you need to delete.

Delete a Folder

Under the Files tab, find the folder you want to delete, in the right, click the dropdown list, and then click Delete to open the Delete Item window.

To delete the folder, enter the name of the bucket, and then click Delete.

Delete Multiple Folders

Under the Files tab, in the left, click the checkbox of all the folders you want to delete, click the new Actions dropdown used for executing an action for multiple folders, and then click Delete to open the Delete Items window.

To delete multiple folders, enter the name of the bucket, and then click Delete.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.