Hi phbryan,
Here is some code that goes through a list of files in a folder and only keeps the 50 most recently saved. The variables "nPath", "extFile" and "LimitFile" are set based on your description above. "nPath" is the directory where the backups reside, "extFile" is the file extension, in this case ".mdb" and "LimitFile" is the number of files to keep, which is 50 based on your description. You can change these variables as necessary if your specs are different than what I assumed.
The program iterates through all the files and deletes the oldest one each time, so if you have 500 files and are keeping 50, it might take it a while to run. If there are only about 50, it should take only a few seconds. Here is the code:
Hope that helps,
Dan
Bookmarks