Delete a file

Last modified: March 7th, 2024

Deleting files in CloudCannon does not occur immediately. Instead, the Delete file action will mark the file for deletion and add a Deleted badge to the file card. CloudCannon will delete marked files the next time you save your changes.

This workflow protects your site from unintentional file deletion by providing multiple opportunities to cancel the deletion.

To mark a file or folder for deletion:

  1. Navigate to the item you want to delete in your collection or file browser.
  2. Open the Context menu by clicking the icon in the top right of the file card.
  3. Select Delete item or Delete folder.

CloudCannon will mark your item for deletion and add a Deleted badge to the file card.

A closeup of the Collection Browser shows the option to 'Delete item' in the file Context Menu.

Alternatively, you can delete a file using the File menu in the top left corner of the editing interface.

You can still open files marked for deletion in an editing interface. These files are in read-only mode, and a red Deleted file banner will appear at the bottom of the editing interface.

The Content Editor in the CloudCannon app shows a 'This file has been deleted' banner with the option to 'Restore file'.

Once you save your changes, CloudCannon will sync to your Git repository and delete your files.

Delete a file with unsaved changes#

You cannot immediately delete a file with unsaved changes or folders that contain files with unsaved changes.

While there are unsaved changes, CloudCannon will disable the Delete item option in the Context menu and the editing interface File menu. To protect your work, CloudCannon requires you to explicitly discard your unsaved changes before you can mark a file for deletion.

A closeup of the Collection Browser shows the option to 'Discard unsaved changes' in the file Context Menu.

To discard unsaved changes:

  1. Navigate to the item you want to delete in your collection or file browser.
  2. Open the Context menu by clicking the icon in the top right of the file card.
  3. Select Discard unsaved changes.
  4. In the Discard unsaved changes modal, review the files that will be affected (if you are discarding a folder, this may affect many files).
  5. Click Discard unsaved changes.

CloudCannon will discard your unsaved changes and enable the Delete option in the Context menu and File menu.

Alternatively, you can discard unsaved changes from the editing interface using the File menu in the top left corner.

New files will be destroyed when you discard unsaved changes.

Restore a deleted file#

You can restore files marked for deletion before you save your site. Restoring a file does not restore any unsaved changes discarded before marking the file for deletion.

To restore a file:

  1. Navigate to the item you want to delete in your collection or file browser.
  2. Open the Context menu by clicking the icon in the top right of the file card.
  3. Select Restore file.

CloudCannon will restore your file and remove the Deleted badge.

A closeup of the Collection Browser shows the option to 'Restore file' in the file Context Menu.

Alternatively, you can restore a file using the File menu in the top left of an editing interface or the Restore file button in the Deleted file banner at the bottom of an editing interface.

Open in a new tab