Backup and Restore Use File History Cleanup to Delete Older Versions of Files in Windows 11

  • Staff
File_History_banner.png

File History regularly backs up versions of your files in the Documents, Music, Pictures, Videos, and Desktop folders and the OneDrive files available offline on your PC. Over time, you'll have a complete history of your files. If the originals are lost, damaged, or deleted, you can restore them. You can also browse and restore different versions of your files. For example, if you want to restore an older version of a file (even if it wasn't deleted or lost), you can browse through a timeline, select the version you want, and restore it.

File History only backs up copies of files that are in all folders and subfolders inside your account's C:\Users\<username> folder. If you have files or folders elsewhere that you want backed up, you can add them to one of these folders.

File History takes advantage of a feature built into the NTFS file system called the change journal to keep track of changes to files. Essentially, when any change is made to a file or folder on your hard disk, the change journal is updated with a description of the change and the name of the file or folder. So to determine which files need to be backed up, File History simply consults the NTFS change journal. Using the change journal is fast and efficient and won't use up a lot of system resources like running a conventional backup routine does.

When you set up File History, you select how long to keep saved versions before they are automatically deleted. Saved versions are kept forever by default.

You can use File History Cleanup to manually delete versions of files and folders older than the selected age, except the most recent version of a file or folder. All other files and folders, such as versions were excluded or removed from your libraries, are also deleted.

This tutorial will show you how to use File History Cleanup to delete older saved versions of files and folders for your account in Windows 10 and Windows 11.


Contents

  • Option One: Use File History Cleanup in Control Panel
  • Option Two: Use File History Cleanup in Command Prompt





OPTION ONE

Use File History Cleanup in Control Panel


1 Open the Control Panel (icons view), and click/tap on the File History icon.

2 Click/tap on Advanced settings in the left pane. (see screenshot below)

Clean_up_versions_of_File_History-1.png

3 Click/tap on the Clean up versions link in the Versions section. (see screenshot below)

Clean_up_versions_of_File_History-2.png

4 Select the time period of versions you want to delete, and click/tap on Clean up. (see screenshot below)

Clean_up_versions_of_File_History-3.png

5 If File History Cleanup didn't find any versions of your files that were that old, click/tap on Close, and repeat step 4 (if wanted) to choose a shorter period of time and try again. (see screenshot below)

Clean_up_versions_of_File_History-4.png

6 If File History Cleanup did find versions of your files that were that old and cleanup completed successfully, click/tap on OK. (see screenshot below)

Clean_up_versions_of_File_History-5.png

7 You can now close the Control Panel if you like.






OPTION TWO

Use File History Cleanup in Command Prompt


1 Open Windows Terminal, and select either Windows PowerShell or Command Prompt.

2 Copy and paste the command below for the time period of versions you want to delete into the command prompt, and press Enter.

The -quite switch option in the commands below is used to not get a message dialog after deleting older versions of files and folders.

For more usage details on the FhManagew.exe command, see: FhManagew.exe | Microsoft Docs


All but the latest one
FhManagew.exe -cleanup 0

FhManagew.exe -cleanup 0 -quiet


Older than 1 month
FhManagew.exe -cleanup 30

FhManagew.exe -cleanup 30 -quiet


Older than 3 months
FhManagew.exe -cleanup 90

FhManagew.exe -cleanup 90 -quiet


Older than 6 months
FhManagew.exe -cleanup 180

FhManagew.exe -cleanup 180 -quiet


Older than 9 months
FhManagew.exe -cleanup 270

FhManagew.exe -cleanup 270 -quiet


Older than 1 year (default)
FhManagew.exe -cleanup 360

FhManagew.exe -cleanup 360 -quiet


Older than 2 years
FhManagew.exe -cleanup 720

FhManagew.exe -cleanup 720 -quiet


3 If File History Cleanup didn't find any versions of your files that were that old, click/tap on Close, and repeat step 2 (if wanted) to use a shorter period of time and try again. (see screenshot below)

You will not see this message dialog if you used the -quite switch in the command.


Clean_up_versions_of_File_History-4.png

4 If File History Cleanup did find versions of your files that were that old and cleanup completed successfully, click/tap on OK. (see screenshot below)

You will not see this message dialog if you used the -quite switch in the command.


Clean_up_versions_of_File_History-5.png

5 You can now close Windows Terminal if you like.


That's it,
Shawn Brink


 

Attachments

  • File_History.png
    File_History.png
    9.1 KB · Views: 12
Last edited:
Top Bottom