Obtaining one .dwg file from each directory in a list
Posted: 20 Dec 2021 08:18
Hi, I have a list of directories that each contain several .dwg files. I would like to get the file path of one .dwg from each folder in the list and make a new list of these files for later processing.
Both lists are stored in text files. DirList.txt contains the input directories and 250List.txt contains the output dwg files.
Unfortunately, my script gives an error: "File Not Found" and appends "ECHO is off." to 250List.txt
Could someone lend me a hand in determining what is wrong with my code? Thanks.
Both lists are stored in text files. DirList.txt contains the input directories and 250List.txt contains the output dwg files.
Unfortunately, my script gives an error: "File Not Found" and appends "ECHO is off." to 250List.txt
Could someone lend me a hand in determining what is wrong with my code? Thanks.
Code: Select all
@echo off
cls
setlocal enabledelayedexpansion
FOR %%G IN (DirList.txt) DO (
for /f "delims=" %%F in ('dir %%G\*.dwg /b /o-n') do set file=%%F
echo %file%>>C:\Users\Craw\250\Last250List.txt
)
endlocal
pause