Page 1 of 1

Need simple bat file to check if a file exisits by name &

Posted: 21 May 2009 05:30
by randym431
Im have very basic dos bat file experience.
I need a simple as possible bat file to check multiple
sub directories under a parent directory, to check for a file name
by name and its date. If it is present, then is it possible to que up a print of the results? Or just create a list of the results in text file.
Subdirectory after subdirectory.

Posted: 21 May 2009 09:13
by avery_larry
set parentdir=c:\program files

dir /s "%parentdir%\file.name" > outfile.txt

Posted: 21 May 2009 18:55
by randym431
THanks!
Actually you got me started.
What I ended up just needing is a very simple
bat command:

D:
cd ss\rw\input
dir filename.* /s > results.txt

That gave me what I needed.
But can I also send this results.txt file to a networked printer, adding
bat file commands?

Posted: 22 May 2009 12:20
by avery_larry
If you capture the printer port to an LPT port, you can just

copy results.txt lpt1

Posted: 28 May 2009 09:54
by RElliott63
Ya know...

dir filename.* /b/s > results.txt

it would give you a single line entry for each file with the Path built into it. instead of all the header info for each Sub Directory its in.

FWIW

-Rick