Home

Searching a folder for duplicate model names (standard and instances).

This batch file should be executed in the folder you wish to search in.

set LogFile=Duplicated_File_Names.txt

echo.
echo.This program will create a list of duplicate ProE files
echo.and place them in a file called "%LogFile%"
echo.
echo.It is recommended that you delete the "*.idx" file and
echo.recreate it in ProE before continuing.
echo.

for /F %%i in ('dir /b *.idx') do set idxfile=%%i

echo Files Duplicated - Files and Generics >%LogFile%
echo.>>%LogFile%
Date /t >>%LogFile%
Time /t >>%LogFile%
echo.>>%LogFile%
echo.>>%LogFile%

:FilesandGenerics

for /f "tokens=1,2,3 eol=I" %%i in (%idxfile%) do if exist %%j.prt.* echo "%%j" found as file and in Generic "%%k" >>%LogFile%
for /f "tokens=1,2,3 eol=I" %%i in (%idxfile%) do if exist %%j.asm.* echo "%%j" found as file and in Generic "%%k" >>%LogFile%

echo.>>%LogFile%
echo Files Duplicated - Generics and Generics >>%LogFile%
echo.>>%LogFile%

:Generics

echo.>>%LogFile%
Date /t >>%LogFile%
Time /t >>%LogFile%
echo.>>%LogFile%
echo.>>%LogFile%

set PartOld=
set PartNew=
set GenericOld=
set GenericNew=

for /f "tokens=2,3 eol=I" %%i in (%idxfile%) do call :ValueSet %%i %%j

goto :End

:ValueSet
set PartOld=%PartNew%
set PartNew=%1
set GenericOld=%GenericNew%
set GenericNew=%2
call :ValueCompare %PartOld% %PartNew% %GenericOld% %GenericNew%
goto :eof

:ValueCompare
if /I "%1"=="%2" echo "%1" Duplicated in "%3" and "%4" >>%LogFile%
goto :eof

:End

echo.>>%LogFile%
echo Completed >>%LogFile%
echo.>>%LogFile%
Date /t >>%LogFile%
Time /t >>%LogFile%
echo.>>%LogFile%
echo.>>%LogFile%