0

I want to delete all folders, subfolders and files older than ome day in a specific directory and leave one folder untouched with the forfiles like the command below:

forfiles /p "C:\path\tocheck" /s /m *.* /c "cmd /c for /d %%i in (C:\path\tocheck\\*) do if /i not "%%~nxi"=="foldernottobedeleted" rd /s /q "%%i"" /D -1

The command above deletes everything except the one file I want to keep included and the files that are new, it skips the /d parameter.Where am I wrong?

Chenmunka
  • 3,228
chr
  • 9

0 Answers0