Dr. Demento
Well-known Member
- Joined
- Nov 2, 2010
- Messages
- 618
- Office Version
- 2019
- 2016
- Platform
- Windows
I create a timestamped backup of my Personal.xlsb (filename & "_yyyymmdd_hhss") everytime I save it. As you can imagine, this leads to a lot of versions each day. Sometimes I need to go back a few hours within the day, so creating the backups using the date only doesn't work.
Could someone give me some pointers how I might loop thru all files within a specified folder, and deleting all files EXCEPT the last saved file of each individual day. I'd likely run this once a week, so I keep the number of files manageable.
For example, if the following files were in a folder:
Personal.xlsb_20160914_1023.bak
Personal.xlsb_20160914_1700.bak
Personal.xlsb_20160915_1156.bak
Personal.xlsb_20160915_1444.bak
Personal.xlsb_20160915_1603.bak
All files except the two below would get deleted:
Personal.xlsb_20160914_1700.bak
Personal.xlsb_20160915_1603.bak
Thanks y'all.
Could someone give me some pointers how I might loop thru all files within a specified folder, and deleting all files EXCEPT the last saved file of each individual day. I'd likely run this once a week, so I keep the number of files manageable.
For example, if the following files were in a folder:
Personal.xlsb_20160914_1023.bak
Personal.xlsb_20160914_1700.bak
Personal.xlsb_20160915_1156.bak
Personal.xlsb_20160915_1444.bak
Personal.xlsb_20160915_1603.bak
All files except the two below would get deleted:
Personal.xlsb_20160914_1700.bak
Personal.xlsb_20160915_1603.bak
Thanks y'all.
Last edited: