TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Tony Ingenoso
from: Chris Robinson
date: 2003-06-26 09:06:12
subject: Re: Batch File Question

From: Chris Robinson 

Yeh - I tried the bare formatting for DIR already - It's neither here nor
there really.  As long as I have a file that contains the original contents
to compare the newly created text file to it doesn't really matter.

Thanks for the suggestion though.

Chris :o)

Tony Ingenoso wrote:

> Oh, DIR /B on an empty directory produces nothing BTW.
>
> So something like DIR /B > \foobar produces a zero length file called foobar.
Simply COMP'ing (or FC'ing) a known zero length file
> with the DIR results should do it.  If the COMP/FC mismatches, then there's
something in that directory.
>
> "Tony Ingenoso"  wrote in message
news:3efa0b6f$1{at}w3.nls.net...
> > IF /?  (then check out the EXIST option)
> >
> > "Chris Robinson"
 wrote in message
news:3EF9C540.66D7A5AF{at}NOSPAMtotalise.co.uk...
> > > I have a share set up on one of our PC's that's set to have
Everyone as
> > > Full Controll.  The idea being that if we get any Virus's
that propogate
> > > to network shares, we'll know about it.  I want to write a batch file
> > > that checks the Directory periodically (I'll use task
scheduler) and, if
> > > it finds a file in there, does a NET SEND to my PC so I know something
> > > could be wrong.
> > >
> > > I've tried a few things so far, but the one I'm working on
at the moment
> > > is this (NT4, SP6 btw) - Prior to running the batch file,
I've created a
> > > text file from "dir > testdir-clean.txt" that
is basically the test
> > > directory with no files in it (i.e. "Clean"):
> > >
> > > *****Start of Batch File*****
> > >
> > > dir c:\testdir > testdir-current.txt
> > > fc /L c:\testdir-clean.txt c:\testdir-current.txt
> > >
> > > IF ERRORLEVEL 1 GOTO _POSSVIRUS
> > >
> > > IF ERRORLEVEL 0 GOTO _NOVIRUS
> > >
> > > :_POSSVIRUS
> > > NET SEND mypcname File detected
> > > EXIT
> > >
> > > :_NOVIRUS
> > > EXIT
> > >
> > > *****End Of batch File*****
> > >
> > > So, "fc" is file compare and "/L"
compares the files as ASCII text.  The
> > > idea being that if it detects a difference, then another
file is present
> > > in the directory.  I'm not 100% certain on the use of the ERRORLEVEL
> > > section though and this is the bit that doesn't seem to be
working atm -
> > > any ideas?
> > >
> > > Cheers,
> > > Chris.
> > >
> >
> >

--- BBBS/NT v4.01 Flag-4
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270
@PATH: 379/45 1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.