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.
forfiles /P D:\backups\configFiles\ /S /M *.tar /D -30 /C "cmd /c del @PATH"
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.
for /f %%A in ('dir ^| find "File(s)"') do set cnt=%%A
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 >>