I have an access database auto-creating backups to a certain folder. If the backup folder had more than 50 backup files, I want to have the new backup included in the folder while deleting the oldest backup so the folder won't exceed 50 files of backup.
Using powershell something similar to this
Get-ChildItem –Path "C:\path\to\folder" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item
Then set the script to run daily in task scheduler or similar
Full example and source on how to create powershell script and schedule
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.