If the file does not exist, rename the referencing file in *.BAD
SETLOCAL ENABLEDELAYEDEXPANSION
::use local variables
set di=c:\temp
for %%f in (%di%\*.ctl) do (
set di=c:\temp
for %%f in (%di%\*.ctl) do (
::look in every file that ends in .ctl
for /f "tokens=1,* delims==" %%a in ('findstr /i "object_name=" "%%f"') do (
for /f "tokens=1,* delims==" %%a in ('findstr /i "object_name=" "%%f"') do (
::get the name of the second file from the variable "object_name"
if not exist "%di%\%%b"(
if not exist "%di%\%%b"(
::if the second file does not exist
move /y "%%f" "%%f.BAD" >>%di%\script_report.log
move /y "%%f" "%%f.BAD" >>%di%\script_report.log
::rename the .ctl file in .bad and let a trace in a logfile
)
)
)
ENDLOCAL
type aaa.ctl:
[...]
object_name=File.txt
[...]
No comments:
Post a Comment