I'm having trouble with a script. Here is the requirement:
Delete files older than 15 days but ignoring any file names containing the string "String".
Here is what I have so far, ignoring file names with "Month", but I can't seem to finish it up.
%%i below contains the potential list of files to delete, but I need to parse that list and only delete files older than 15 days.
Code: Select all
@echo off
setlocal disableDelayedExpansion
for /f "usebackq tokens=*" %%i in (`dir /a:-d /b /s %Target_PATH%*.* ^| findstr /v "[\\][^\\]*Month[^\\]*$"` ) do (
::code here
)
endlocal
PAUSE
Thanks!