ThisCalculator

Everyday

Nextcloud File Recovery: How It Works

Updated · Standard formula, shown below

Nextcloud File Recovery: How It Works

Nextcloud file recovery lets you restore previous versions of files and recover deleted files directly from the web interface, desktop client, or mobile app. You get this protection through the built-in Versions and Trashbin apps, which work automatically once enabled by an administrator. This article explains how to use these features, how long files are kept, and what to do when recovery fails.

Background: Why Nextcloud Has Its Own Recovery System

Nextcloud is a self-hosted file sync and share platform, meaning you control the server. Unlike cloud services that keep proprietary backups, Nextcloud gives you two distinct recovery tools: Versions (older copies of the same file) and Trashbin (deleted files). Both are part of the default Nextcloud installation, but they must be enabled in the Apps section of the admin settings. The system works by storing these copies on the server’s storage, so recovery does not depend on your local device’s recycle bin.

How Versions Work

Versions are automatic snapshots of a file taken whenever you modify and save it. Nextcloud does not keep every single save; it uses an algorithm that keeps more versions for recent changes and fewer for older ones. The default retention policy is:

  • Keep a version every 2 minutes for the first 10 minutes
  • Keep a version every hour for the first 24 hours
  • Keep a version every day for the first 30 days
  • Keep a version every week until the file is deleted or the version limit is reached

This means you can typically restore a file to how it looked yesterday, last week, or even a month ago, but not every minor edit from three weeks ago. The exact times are configurable by the administrator via the versions_retention_obligation setting in the config.php file. For example, setting it to auto uses the default schedule, while a custom value like 0, 2592000 keeps versions for 30 days (2592000 seconds) after the file is deleted.

How to Restore a Previous Version

To recover an older version of a file:

  1. Log in to your Nextcloud web interface.
  2. Navigate to the file you want to restore.
  3. Click the three-dot menu (or right-click) and select Versions.
  4. A panel appears listing all available versions with timestamps and file sizes.
  5. Click the three-dot menu next to the version you want and choose Restore.

The restored version overwrites the current file on the server. If you want to keep the current version, download the old version first by selecting Download instead of Restore.

Recovering Deleted Files from Trashbin

When you delete a file in Nextcloud, it moves to the Trashbin, not permanently erased. To recover it:

  1. Open the Nextcloud web interface.
  2. Click the Deleted files link in the left sidebar (often under the file list).
  3. Find the file or folder you need. You can browse or search.
  4. Click the three-dot menu and select Restore.

Restored files return to their original location if that folder still exists; otherwise, they appear in the root directory. Folders are restored with their entire contents, including subfolders.

Retention and Storage Limits

Trashbin retention is controlled by the trashbin_retention_obligation setting. The default is auto, which uses the same time-based schedule as versions: files are kept for 30 days after deletion. However, the actual storage space is also a factor. If the trashbin grows too large, Nextcloud may purge older entries earlier. Administrators can set a fixed retention period, such as 0, 86400 for 24 hours, or 1, 0 to keep files forever until manually cleared.

Both Versions and Trashbin consume server storage. A file that is edited 50 times could occupy 50 times its current size in versions. If you have limited disk space, consider setting a lower retention period or using external storage with versioning disabled.

Common Problems and Misconceptions

“I deleted a file, but it’s not in Trashbin.” This can happen if the file was deleted from a shared folder by another user who has permission to delete, or if the Trashbin was emptied manually. Also, if the file was deleted via the desktop client, it may take a few minutes to sync to the server’s Trashbin.

“I see versions, but Restore does nothing.” Ensure you have write permission to the file’s folder. If you are viewing a shared file with read-only access, you cannot restore. Also, check if the file is locked by another user (a lock icon appears).

“Versions are missing for files I edited today.” The versioning algorithm may not create a version if the change is too small or if the file was edited multiple times within a short period. It keeps the latest state, not every intermediate save.

“Recovery does not work for files on external storage.” By default, Versions and Trashbin are only enabled for local storage. For external storage (like S3 or FTP), you must enable the files_external app’s versioning and trashbin options, which may not be available for all backends.

Comparison with Other Recovery Methods

Nextcloud’s built-in recovery is not a substitute for a full backup. It protects against accidental edits and deletions, but not against server failure, ransomware, or a malicious admin wiping the instance. For that, you need a separate backup solution, such as BorgBackup, rsync, or a provider that snapshots your server. The key difference: Versions and Trashbin live on the same server as your files, so if the server’s disk dies, both the files and their recovery copies are lost. A proper backup stores copies offsite.

Costs and Storage Considerations

There is no monetary cost for using Versions and Trashbin—they are free features of Nextcloud. The real cost is storage space. Each version and each deleted file occupies space on your server. If you have a 100 GB quota, and you edit a 1 GB file 20 times, you could use an extra 20 GB for versions. Administrators can monitor usage in the admin overview and adjust retention settings accordingly. For large deployments, consider using a storage backend with built-in deduplication, or set a strict retention policy.

Alternatives and Advanced Recovery

If the built-in features are not enough, you can use the Nextcloud Files Versions API to programmatically list and restore versions. For more granular control, some administrators use the occ command-line tool to manually purge or restore versions. For end users, there is no other official recovery method within Nextcloud itself. If you need point-in-time recovery of the entire database and files, you must rely on server-level snapshots (e.g., LVM, ZFS) or a backup application that works with Nextcloud’s storage.

Frequently Asked Questions

How long are deleted files kept in Nextcloud? By default, 30 days, but the administrator can change this. After that period, files are permanently removed from the Trashbin and cannot be recovered through the web interface.

Can I recover a file that was deleted more than 30 days ago? Only if the administrator set a longer retention period, or if you have a separate backup. Once the Trashbin purges a file, it is gone from Nextcloud’s perspective.

Does versioning work on folders? No, versioning works on individual files. However, when you restore a folder from the Trashbin, all files inside it are restored with their current versions, not historical versions of each file.

Why can’t I see the Versions option for a shared file? You need at least write permission on the file. If you are a read-only sharee, you can only download the current version, not restore previous ones.

How do I permanently delete a file so it cannot be recovered? Delete the file, then go to the Trashbin and select Delete permanently for that file. This removes it from the server immediately, and it cannot be recovered by any user.

Can I recover a file that was overwritten by a sync conflict? Yes, the conflict file (e.g., “file (conflicted copy)”) is treated as a separate file. You can restore the original from its versions, or use the conflict copy if it contains the desired data.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.