File History does point in time backups of your files so that you can revert to the exact copy or version of your files when you need them. In addition, file History allows you to configure how long the backups are retained. However, it doesn’t seem to automatically clear the older versions of the files.
File History doesn’t automatically clear older versions of the files despite choosing an option in the Keep saved versions: dropdown. You can see that in the following screenshot.
I have configured File History to retain the versions stored within the last one month. However, the File History store shows that much older files are intact. The automatic cleanup is not working, and we don’t know if it’s by design or not. Or is it possible that the older versions are purged automatically when the hard disk becomes full? We’re not sure. Windows doesn’t seem to have a task that triggers the cleanup of the older File History versions.
This post tells you how to clean up older versions of your File History backups using two different ways: using the File History GUI or command-line. The command-line can also be automated using Task Scheduler.
How to Cleanup Older File History Backups
Follow any of these methods to clean up older versions of File History backups on your Windows 10/11 computer.
Method 1: Using File History Settings
- Click Start, type Control Panel.
- Click Control Panel from the search results.
- Set Control Panel to icons view, and click File History
- Click Advanced Settings in the Tasks pane.
- In this screen, you can configure the frequency of backups and how long the backups are stored. To delete older versions from the File History backup, click Clean up versions.
- Select one of the following options in the dropdown, and click Clean up.
- All but the latest one
- Older than 1 month
- Older than 3 months
- Older than 6 months
- Older than 9 months
- Older than 1 year (default)
- Older than 2 years
Method 2: Using Command Prompt
To clear older versions of file history backups, there is also a command-line tool named fhmanagew.exe. FhManagew.exe deletes file versions that exceed a specified age from the currently assigned File History target device.
For instance, to delete all file history backup versions that are older than
45 days, open a Command Prompt window and type:
FhManagew.exe -cleanup 45
Note: If no files match the age criteria you specified (files older than
45 days), the following message would appear.
Choose a shorter period of time and try again.
The command-line tool supports the
-quiet parameter which suppresses output message(s) and the dialog shown above. To do the clean up silently, you’d use:
FhManagew.exe -cleanup 45 -quiet
That’s it! Backup copies older than 45 days are removed. The oldest backup dates back to May 29 now.
In addition to the above
-cleanup switch, FhManageW.exe supports the following switches, which aren’t officially documented.
Run File History backup on demand, manually.
Stop File History backup that’s currently running
Open File History settings page:
Checks (Error checking) the drive assigned as the File History backup drive:
Using FhManageW with Task Scheduler
You can automatically clear older versions of File History backups using Task Scheduler.
- Open Task Scheduler, and click Create Task.
- Assign a name and description for the task — e.g., Clear Old File History Backups
- Select the Triggers tab, and click New.
- In the Begin the task: On a Schedule will be the default selection.
- Select the frequency you want the task to run: Weekly, Daily, or Monthly. For example, you may choose Weekly, and select the day(s) you want the job to run. Multiple choices are allowed.
- Click OK, select the Actions tab, and click New.
- In the Program/Script text box, type
- In the Add arguments: type
-cleanup 45 -quiet
(The above command-line clears file history versions older than 45 days.)
- Click Ok, and select the Settings tab.
- Enable Run task as soon as possible after a scheduled start is missed
- Click OK.
I hope the scheduled task method plugs the shortcoming of the File History tool and helps save disk space by regularly purging the older versions of your files.
One small request: If you liked this post, please share this?One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
5 thoughts on “How to Cleanup Older File History Backups in Windows 10/11”
Is there a way to retain just the 3 most recent versions of a file, regardless of when they were last saved? If I choose to delete files older than 3 months, and there is only one version of a file (and IT is older than 3 months), is that one version kept even though it is older than 3 months? Thanks.
@MG: I don’t know how to set about keeping the latest 3 versions, but I think I can reassure you that at least one version will remain.
The dialogue in File History Clean-up says:
“The clean-up deletes 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 that were excluded or removed from your libraries, are also deleted.”
So that looks as though any file which File History has backed up will have at least its most recent version preserved, even if it’s older than the age you chose.
But I can’t tell from that whether a file such as the following would have ALL its versions deleted:
a file, in one of your libraries that File History already backs up, that is older than your chosen age but which you have since deleted from that library.
I guess the answer would be to create such a file in a new library, let File History create several versions, then delete it from your library and see what Clean-up does to it. Would that answer your question?
[edited by admin — merged the addition comment into this.]
I backup files in appdata, because of some pop3 and local email accounts. The multiple copies of these large files consumes massive space. If I Manually delete those files from the file history folder, will there be any ill effects (other than not being able to restore the specific file from particular date)?
When I run fhmanagew -cleanup 0, I receive a message saying “could not clean up file history – element not found”
When I run fhmanagew -checktarget, it checks my file history drive (G:), so I don’t understand why it won’t clean up older versions on that drive