forfiles /P D:\backups\configFiles\ /S /M *.tar /D -30 /C "cmd /c del @PATH"
But I want to only delete files if there are more than 10 files in the folder. I found this code for counting the files, but can't get it to work.for /f %%A in ('dir ^| find "File(s)"') do set cnt=%%A
Can someone show me what I need to add to my batch file to keep the delete command from deleting if there are less than 11 files in the folder. In other words, if there are 10 files or less, then I want it to skip the deletion.
Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.