Hi, I've searched around a bit, but haven't found a solution for my particular problem.
We do workstation image backups which are saved to a NAS device. One full backup a week and differentials on the remaining weekdays. I'd like to always have at least two full backups present, regardless of the age. This is in case something gets weird with the scheduled task or connection to the NAS which prevents the backups from occurring. This way I don't end up in a situation where a month has gone by without a backup, but the forfiles batch has been deleting everything and the folder is empty. Not an ideal situation.
I want to delete files older than 14 days using forfiles, which I already have a working batch script for. That part is done.
The tricky part is, I would like the above batch to run only if a certain amount of files exist. Something along the lines of:
if equal to or more than 3 of a certain file type exist, then run forfiles script that deletes files older than 14 days.
Is this beyond what cmd commands and forfiles can do? Seems simple, but i'm not seeing it. I'm not a scripting pro, so I'd like to keep it simple. Other ideas besides using forfiles would be appreciated! Thank you.