I'm trying to cycle through a list of users (office_id_list_%YY_MM_DD%\%%
) that I have for each office (office_list.txt) and create a file when files newer that a date (%3
) are found. The below code wasn't working so I decided to echo the errorlevel and found that it was always -1073741510
(working on a Windows 2003 machine). Ultimately, I'm trying to identify user home directories(organized by office) that have not been modified since a given date.
Any thoughts would be greatly appreciated.
for /f "tokens=1 delims= " %%i in (U:\sysmon\u_cleanup\office_list.txt) do (
if not exist u:\sysmon\u_cleanup\results\%%i mkdir u:\sysmon\u_cleanup\results\%%i
for /f "tokens=1 delims= " %%j in (U:\sysmon\u_cleanup\results\office_lists_%YY_MM_DD%\%%i_dir_list_%YY_MM_DD%_final.txt) do (
forfiles /P %1%%i\%%j /S /D +%3 /C "cmd /c if %errorlevel% == 0 echo ** Do not Archive - Found files modified after %3 > U:\sysmon\u_cleanup\results\%%i\%%j_%YY_MM_DD%.txt"
)
)