| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Batch File Question |
From: "Tony Ingenoso"
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™.