![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
![]() |
#1 |
Admiral
![]() Join Date: May 2003
Location: Midlands, UK
Posts: 2,139
Downloads: 22
Uploads: 0
|
![]()
hey all, I need someone who knows how to write a windows batch file to return a list (in a simple .txt file) of a specific file extension (.dwg) in the current directory that the batch file is run from.
I used to have one of these but canot find or remember how to code it. Can anyone help?
__________________
when you’ve been so long in the desert, any water, no matter how brackish, looks like life ![]() |
![]() |
![]() |
![]() |
#2 |
Silent Hunter
![]() Join Date: Jul 2007
Location: The Peach State
Posts: 4,171
Downloads: 141
Uploads: 10
|
![]() Code:
dir *.dwg > textfilename.txt |
![]() |
![]() |
![]() |
#3 |
Admiral
![]() Join Date: May 2003
Location: Midlands, UK
Posts: 2,139
Downloads: 22
Uploads: 0
|
![]()
hmm, thanks that's the stuff. Any ideas about including subdirectories of the folder that the .bat file is located in?
__________________
when you’ve been so long in the desert, any water, no matter how brackish, looks like life ![]() |
![]() |
![]() |
![]() |
#4 |
Ace of the Deep
![]() Join Date: Sep 2002
Location: Austria
Posts: 1,070
Downloads: 0
Uploads: 0
|
![]()
cmd /C dir /S *.dwg /A > list.txt
This will close the console after it's finished. And also give you the files located in subdirectories... depending on how much there are you'll maybe want to use the the switch /B with the dir command, then you'll only get the paths written to the text file The command in the batch file would look like this... cmd /C dir /S /B *.dwg /A > list.txt Or easier dir /S /B *.dwg > list.txt That'll close aswell after it has finished Last edited by VipertheSniper; 09-02-08 at 12:02 PM. |
![]() |
![]() |
![]() |
#5 |
Admiral
![]() Join Date: May 2003
Location: Midlands, UK
Posts: 2,139
Downloads: 22
Uploads: 0
|
![]()
nevermind, I think I've found what I'm looking for thanks to your prompt
![]() Code:
DIR *.DWG /s /b > DWGlist.txt ahah! there's more lol
__________________
when you’ve been so long in the desert, any water, no matter how brackish, looks like life ![]() |
![]() |
![]() |
![]() |
#6 |
Admiral
![]() Join Date: May 2003
Location: Midlands, UK
Posts: 2,139
Downloads: 22
Uploads: 0
|
![]()
I never did learn how to use dos code properly
basic AutoLisp code, now that I can handle (well mostly). Thanks again ![]()
__________________
when you’ve been so long in the desert, any water, no matter how brackish, looks like life ![]() |
![]() |
![]() |
![]() |
#7 |
Admiral
![]() Join Date: May 2003
Location: Midlands, UK
Posts: 2,139
Downloads: 22
Uploads: 0
|
![]()
All works according to plan until I try and use it on a network drive, on the console pops up for a split second and complains about UNC something or other.
![]() Ah well.
__________________
when you’ve been so long in the desert, any water, no matter how brackish, looks like life ![]() |
![]() |
![]() |
![]() |
#8 |
Ace of the Deep
![]() Join Date: Sep 2002
Location: Austria
Posts: 1,070
Downloads: 0
Uploads: 0
|
![]()
Go to the folder you want to execute the *.bat from, then just paste the command of the batch file into the console. The console will stay open, and you can read the error message.
|
![]() |
![]() |
![]() |
|
|