I'm not looking for any work around, unless Forfiles has an issue.
I need to know my mistakes with this.
NOTE-01: The prompt below is via pushd. No matter if via pushd or the local machines' terminal; the results remain the same.
W:\TEMP_TESTING_Copy>dir /a:d /b
20230326
20230327
20230328
20230329
20230330
old.bat Version 01:
@echo off
Setlocal EnableDelayedExpansion
ForFiles /p "X:\TEMP_TESTING_Copy" /s /d -03/27/2023 /c "cmd /c IF @isdir==TRUE rd /S @PATH"
W:\TEMP_TESTING_Copy>old
X:\TEMP_TESTING_Copy\20230326, Are you sure (Y/N)? n
X:\TEMP_TESTING_Copy\20230327, Are you sure (Y/N)? n
^CTerminate batch job (Y/N)? y <-- She hangs until manually terminated.
old.bat Version 02:
@echo off
Setlocal EnableDelayedExpansion
ForFiles /p "X:\TEMP_TESTING_Copy" /s /d -03/27/2023 /c "cmd /c IF @isdir==TRUE rd /S /Q @PATH"
W:\TEMP_TESTING_Copy>old
ERROR: The system cannot find the file specified.
ERROR: The system cannot find the file specified.
Press any key to continue . . .
W:\TEMP_TESTING_Copy>
W:\TEMP_TESTING_Copy>dir /a:d /b
20230328
20230329
20230330
Obviously the specified directories and their contents were removed\deleted.
W:\TEMP_TESTING_Copy>dir /b
20230328
20230329
20230330
cln.bat
dd.bat
delete_.txt
napa.txt
old.bat
old.bat - Shortcut.lnk
I have less than a clue about: a) Why the batch-file, after the final y/n confirmation, hangs with only one active command within old.bat, b) Given the /S, /Q and the specified directories were removed; why the two errors?
Respectfully