This batch file can be executed from
anywhere. A folder is entered in the file that contains the models that
you wish to perform a "where used" for (e.g. LibraryFolder)
and the top folder you want to recursively perform this function on (e.g. ProEFiles).
WARNING: This will
call the "purge" command so only the latest Pro/ENGINEER files will
exist. You can comment this out but then your "Where Used" list will
grow larger.
prompt $B
path=%path%;<Path to your ProE loadpoint\bin folder>
set LibraryFolder=<Your Library folder>
set LibraryIDXFile=%LibraryFolder%\<The file name of your
Library Folder IDX file.idx>
set ProEFiles=<Top Level Target folder>
set FileList=FileList.txt
set PartsList=PartsList.txt
set WhereUsedList=Where-Used.txt
cd /d %LibraryFolder%
call purge.bat
@echo on
del /f /q %PartsList%
del /f /q %FileList%
echo.Building file list ... >%WhereUsedList%
Date /t >>%WhereUsedList%
Time /t >>%WhereUsedList%
echo.>>%WhereUsedList%
echo.>>%WhereUsedList%
dir /b /s %LibraryFolder%\*.asm.* >>%FileList%
dir /b /s %ProEFiles%\*.asm.* >>%FileList%
echo.Building part list ... >%WhereUsedList%
Date /t >>%WhereUsedList%
Time /t >>%WhereUsedList%
echo.>>%WhereUsedList%
echo.>>%WhereUsedList%
for /F "delims=." %%I in ('dir /a:-d /b /o:n %LibraryFolder%\*.prt.*')
do echo.%%I >>%PartsList%
for /F "delims=." %%I in ('dir /a:-d /b /o:n %LibraryFolder%\*.asm.*')
do echo.%%I >>%PartsList%
for /F "tokens=2,3" %%I in (%LibraryIDXFile%) do echo.%%I^<%%J^> >>%PartsList%
echo.Building Where Used list ... >>%WhereUsedList%
Date /t >>%WhereUsedList%
Time /t >>%WhereUsedList%
echo.>>%WhereUsedList%
echo.>>%WhereUsedList%
for /F %%I in (%PartsList%) do (
echo. %%I>>%WhereUsedList%
echo.>>%WhereUsedList%
findstr /i /m /f:%FileList% "%%I" >>%WhereUsedList%
echo.>>%WhereUsedList%
echo.>>%WhereUsedList%
)
echo.Finished Where Used list ... >>%WhereUsedList%
Date /t >>%WhereUsedList%
Time /t >>%WhereUsedList%
echo.>>%WhereUsedList%
echo.>>%WhereUsedList%