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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
randym431
Posts: 2
Joined: 21 May 2009 05:21

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

#1 Post by randym431 » 21 May 2009 05:30

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.

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 21 May 2009 09:13

set parentdir=c:\program files

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

randym431
Posts: 2
Joined: 21 May 2009 05:21

#3 Post by randym431 » 21 May 2009 18:55

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?

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#4 Post by avery_larry » 22 May 2009 12:20

If you capture the printer port to an LPT port, you can just

copy results.txt lpt1

RElliott63
Expert
Posts: 80
Joined: 04 Feb 2009 10:03

#5 Post by RElliott63 » 28 May 2009 09:54

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

Post Reply