đź„Ť

How to enable file versioning on Windows

Windows comes with many great built-in tools that, unfortunately, are hard to discover and even harder to use. One of these is its built-in file versioning tool called File History. Once set up, it can keep copies of old versions of all your files and documents. It can be incredibly useful to restore a previous version of a file or a folder after you’ve made an accidental change or deletion.

“But I don’t use any files and folders on my PC!” Everything on your PC is stored in files in folders. You might not work with documents and spreadsheets, but file versioning is just as useful for your game-save files, source code, and photos. It can also be used with your application data to, for example, restore a deleted browser bookmark or email message.

File History is also the closest Windows comes to protecting your files against data degradation (also known as “bit rot”). It’s satisfying to restore an earlier version of a file after it’s unintentionally changed — whether from a user-, software-, or hardware error.

File History stores complete copies of each of your files, so it might not be suited for large files that are frequently changed (e.g. virtual machines). However, it does mean you can use File History to back up your files as well as file versioning.

Once configured, you can right-click on a file or folder in Windows File Explorer and select Restore previous versions. File History won’t save a new version of every change you make to your files. By default, it runs once every hour, though that can be lowered to every ten or fifteen minutes. Each time it runs, it stores one full copy of each file that has changed since the previous run.

You can either configure File History to back up to a secondary disk or partition, a removable disk, or a network-attached storage (NAS) disk or home server over the SMB protocol (a “Windows network share” or “Samba share”). Each approach has different advantages and drawbacks. The main differences are:

  • Using an internal or removable disk will be much faster than a network share, but requires you to reconnect at least once every ten days. A network share can be more convenient as it can work wirelessly over Wi-Fi, or even over the internet (assuming you can VPN into your home network).
  • Disks and partitions can support file compression. This lets you fit more backup copies into less disk space. Compression is only supported on some types of network shares.
  • Disks and partitions can be encrypted with Windows BitLocker. (Requires Windows Professional edition.) Network shares will be stored unencrypted. You can work around these limitations, but it’s a lot of effort.
  • Disks and partition have a couple of known problems that appear over time. Network shares aren’t affected by these problems; they’re in enterprise setups, so it’s better tested and supported by Microsoft.

Alternatively, you can let File History keep old file versions in a folder on your primary storage disk. This method diminishes File History’s value as a backup service, but you still get the benefits of its file versioning and restoration capabilities. This is probably the best option if you’re only interested in these aspects of File History. It has the advantage of being much faster and more battery-efficient than the other methods.

  1. To get started, open File History from the Control Panel or by searching for it (press the Windows key + S).
  2. Click Select Drive.

From this screen, you can either select a disk or partition on your device or select a network share. You may need to enter the path to your network share manually if Windows can’t discover devices on your network automatically.

The process is almost the same if you want to run File History against a folder on your local device. Create a new folder named “File History” inside your user profile folder (press Windows key + R and type %USERPROFILE% to open it). Right-click on the new folder and select Properties. Click on the Sharing tab and click Share. This should populate the dialog with a network path. Copy and paste this path as the network path to use in File History.

  1. Once you’ve selected a disk to use with file History, find the disk or network share you chose in Windows File Explorer.
  2. Right-click on it and select Properties.
  3. Under Attributes click Advanced.
  4. Enable compression and click OK on both dialogs.
  5. When prompted, confirm that you want to apply the change to the folder and its contents.

Steps three–seven above are optional, but can help make better use of your available disk space. Compression can slow down file access times. However, this isn’t a problem with File History as it’s primarily used for archival and only the occasional file retrieval. Compression might not be available for all network shares.

You also need to add some folder exceptions in File History. It’s important to set up folder exceptions properly to avoid filling your File History archive with downloads, caches, and other ephemeral files.

Despite what the File History control panel says about it only backing up your Library collections, it actually backs up everything in your user profile folder. (This was changed in Windows 10, but Microsoft hasn’t updated the description in the File History control panel.) This includes the hidden AppData folder which contains your temporary items folder (%TEMP%), browser caches, and other ephemeral data. The folder also contains your app settings and data for many apps.

If you’re backing up to a folder inside your user profile directory, you must at the very least exclude this folder. Or you’ll quickly run out of disk space from recursively backing up your backups. To exclude directories from File History:

  1. Go back to the File History control panel and click Exclude folders.
  2. Add the following exclusions:
    • The folder you’re saving your File History into (if this folder exists inside your user profile folder).
    • Your temporary items folder (type %TEMP% into the folder prompt).
    • Your Downloads folder. You can always re-download things, and these files tend to be large.
    • The File History staging and configuration folder (type %LOCALAPPDATA%\Microsoft\Windows\FileHistory into the folder prompt).
    • Optionally, the entire %LOCALAPPDATA% folder. It contains your app settings like browser bookmarks, many game saves, and configuration files. It’s safe to include this folder if you otherwise never open it.

You can use an application like Filelight (available for free in the Microsoft Store) to identify folders you might want to exclude from your backup. Point it at %LOCALAPPDATA% and take a look around.

The last configuration option you should set is the backup frequency. By default, file History stores copies of your changed files once an hour. The default is probably fine if you infrequently work with files. You can change it in the File History control panel by clicking on Advanced settings. Here you can also trigger clean out old versions of files if you need to free up disk space later on.

You can also include folders and even network shares in File History even if they’re located outside your user profile folder. There are two methods that let you do this: either by creating an NTFS file junction to the folder inside your user profile folder, or by including the folder in one of your Library collections.

The latter method is the easier one to set up. Press the Windows key + R and type shell:Libraries to manage your library collections. Right-click on a Library or an empty area of the window and select properties to manage your libraries. Add the desired folders to any of your libraries.

File History might not be the best backup or file versioning tool, but it gets the job done. It’s a shame that Microsoft hasn’t invested more resources into polishing File History and making it easier to use. There were rumors that Microsoft would remove it in Windows 11, but it’s still available.