Listing all assemblies in a folder
Listing all assemblies in a folder
(OP)
I know how to use ugpc.exe to check that a part is an assembly or not
But
I am looking for a .bat file to check all part in a given folder
Thanks in advance if you have this kind of .bat file
But
I am looking for a .bat file to check all part in a given folder
Thanks in advance if you have this kind of .bat file
Regards
Didier Psaltopoulos
http://www.psi-cad.com





RE: Listing all assemblies in a folder
CODE
Let me know if it helps!
Jeff
RE: Listing all assemblies in a folder
Thanks a lot, I adapt it and it works very well.
Could you help me more:
1°) i would like to be able to open all subfolder (have a look at the attached jpeg)
2°) by sending the result in list_ass.txt
Thanks in advance
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
Insert the three lines after the exiting line containing popd.
Modify the next exiting line to match the last line below.
Regards, Joe
CODE -->
RE: Listing all assemblies in a folder
Thanks for your help
I have just one problem: list_ass.txt contain only the last assembly
Where is the error in the below lines ?
___________________________________________________________
@echo off
mkdir asmtemp
mkdir asmtemp\confirmed
for %%X in (*.prt) do (ug_inspect %%X | find "no components? FALSE" > asmtemp\%%X & echo %%X >> asmtemp\%%X)
echo The following files are assemblies:
pushd
for %%X in (asmtemp\*.prt) do (findstr /M FALSE %%X) > asmtemp\confirmed\%%~nxX
for %%X in (asmtemp\confirmed\*.prt) do (if %%~zX EQU 0 del %%X)
i:
popd
setlocal ENABLEDELAYEDEXPANSION
set dir_list=
for /d %%i in (*) do @(echo "%%i" && set dir_list=-p%%i !dir_list!)
for %%X in (asmtemp\confirmed\*.prt) do (ugpc !dir_list! %%~nxX > list_ass.txt & echo --)
echo Scan complete.
pause
________________________________________________________________________
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
This change should output a file for each assembly named with the assembly name and an appended _list_ass.txt
Regards, Joe
CODE --> DOS
RE: Listing all assemblies in a folder
Something is wrong because the folder asmtemp\confirmed contain only the main ass_panther.prt
AND
have a look at the ass_panther_list_ass.txt. It's a little bit confused
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
OK, the report shows that the original assembly (saved on f:\ had some components in sub directories of sub directories. So the original location is displayed when the components are not found in the immediate sub directories (as shown in the original image).
The ugpc.exe utility does not support the "..." notation to walk the directory tree like the "File-> Options -> Load Options" load options does.
Hopefully the code below will include the subordinate lower level(s) of sub directories in addition to the immediate sub directories.
This script is reporting for the assembli(es) in the top level directory and there will be a report file for each top level assembly (which will contain parts and sub assemblies from the sub directories). It is not intended to generate a report for each sub-assembly (which would be somewhat redundant if the top level assembly report works since the sub directory sub assemblies are listed in the report.)
HTH, Joe
CODE --> (old)
CODE --> (new)
RE: Listing all assemblies in a folder
Could you add some indentation in the listing because component and assembly are mixed ?
TIA
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
This will use 4 space indention - edit the "-s" value as desired.
HTH, Joe
CODE --> DOS
RE: Listing all assemblies in a folder
Thanks a lot. I will try it tommorrow
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
The prog works well without sub folder
Could you test the programm with my sub folders because the result is not good: the folder "confirmed" doesn't contain the list of sub assy !!!
The attached zip file contain some component ans sub assembly of my big assembly.
Thanks in advance
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
I am glad you included your batch file. The leading "!" from (Dec 19 9:49) !dir_list! was missing.
I've revised the code to also generate a file of the components that could not be found in the directory or sub directories. The file is named with the assembly name and the _missing.txt suffix and extension. The file will show the path that was last used for the component when the assembly was most recently saved.
CODE --> DOS
I seemed to have failed in my explanation on Dec 19th (14:47) to communicate that the utility was not intended to generate separate files for all levels of sub assemblies.
If you want to use the utility to report on the top level assembly and to repeat that processing for each sub directory and process the assemblies in the sub directories you might consider using the following to invoke the existing utility "for an entire directory tree."
If the existing utility is named for instance, d:\tools\list_assy_in_dir.bat the code below will process the current directory (the normal behavior) and it will reinvoke the utility for each sub directory and report on any assemblies in the sub directories
CODE --> DOS
Alternatively the name of the top level directory can also be included in the command. If, for example, the directory of the top level assembly were e:\directory\subdir\top_level_assy_directory
CODE --> DOS
Regards, Joe
RE: Listing all assemblies in a folder
Have a look at the error file (jpeg attached)
Thanks in advance
Regards
Didier Psaltopoulos
http://www.psi-cad.com
RE: Listing all assemblies in a folder
In my example I have the full path to the list_assy_in_dir.bat. In the screen shot it seems that there is no path to the the script specified. Please try specifying the path explicitly.
Thanks,
Joe