DwgList 2023 Technical Documentation

Batch Files

DwgList 2023 does not support wildcards or any other method of converting multiple files at a time. However, it is easy to automate the conversion process using batch files on both Windows and Linux that do support multiple files and processing subdirectories.

Windows

The following batch file will procesws all DWG files in the current directory and any subdirectories and create an XML file with the extracted content. The batch process calls processFile to convert each dwg file found in the current directory. It then loops through each subdirectory, recursively calling treeProcess to convert the files in the subdirectories.

set exepath=c:\path\to\exe\dwglist2020
call :treeProcess
exit /b

:treeProcess
for %%f in (*.dwg) do call :processFile "%%f"
for /D %%d in (*) do (
    cd %%d
    call :treeProcess
    cd ..
)
exit /b

:processFile
set fName=%1:.dwg=.xml%
del fName
%exepath% %1 -xml
exit /b

Linux

Linux batch file operation is the same as on Windows, just with a different syntax. The following batch file will convert all DWG files in the current directory and any subdirectories and create an XML file with the extracted content. The batch process calls processFile to convert each dwg file found in the current directory. It then loops through each subdirectory, recursively calling treeProcess to convert the files in the subdirectories.

#!/bin/bash
processFile(){
	$exepath "$1" -xml
	}

treeProcess(){
	for file in *.dwg; do 
		if [[ -f $file ]]; then
			processFile "$file"
		fi
	done

	for dir in `find * -type d`; do 
		if [[ $dir != "." ]]; then 
			if [[ $dir != ".." ]]; then
				cd $dir
				treeProcess
				cd ..
			fi
		fi
	done
}

exepath=/home/company/path/to/dwglist2020
treeProcess
Last updated on 16 Jul 2020
Published on 22 Mar 2020