Dec 172017
 
A batch file utility that sets errorlevel if specified file is open (access denied) or missing.
File ACTEST10.ZIP from The Programmer’s Corner in
Category Batch Files
A batch file utility that sets errorlevel if specified file is open (access denied) or missing.
File Name File Size Zip Size Zip Type
ACCTEST.DOC 3607 1518 deflated
ACCTEST.EXE 10588 6521 deflated

Download File ACTEST10.ZIP Here

Contents of the ACCTEST.DOC file



acctest is a file ACCess TESTer. I had Novell networks in mind when I
wrote this program, though it works without a network, and may work
with other networks. acctest is designed to test to see if files are
available to you (aka-not in use by another user) before you run a
program depending on these files. acctest reports its results through
the DOS errorlevel.

acctest was written by Calvin A. Curtindolph on October 24, 1990.


Command Format:
acctest [-verbose] [filespec]

-verbose
--------
-verbose may be specified as many times as desired on the command
line. Each time -verbose is specified, the verbose state is flipped
(off to on, or on to off). When acctest is in the verbose state, the
status of each file tested is announced, with one of the following
results:

File junk.tst is available
File junk.tst does not exist
File junk.tst is not available

If the file is not available, that means that the file exists, but
someone else on the network has use of it.

the filespec
------------
There may be as many file specifications as desired on the command
line. Full path specifications and wildcards may be used. Novell
volume designators (SYS:, etc) may NOT be used.


what does acctest return?
-------------------------
If all files named are available, acctest sets the ERRORLEVEL to 0.
If one or more files are unavailable, the ERRORLEVEL is set to 1. If
one or more of the files do not exist, the ERRORLEVEL is set to 2.
These errorlevels may be tested by a batch file.


Example of acctest use by itself
--------------------------------
acctest a.b -verbose c.d g:\e.f e:\water\*.g -verbose *.c

This line will test for the availability of file a.b, but not display
results. The status of files c.d, g:\e.f, and all files matching
e:\water\*.g will be displayed. The status of all files matching *.c
will not be displayed. The errorlevel will be set as described above.
Note that if no files match either of the wildcard specifications,
that specification will be considered a file which cannot be found
(errorlevel will be set to 2).


Example of acctest in use in a batch file
-----------------------------------------
@echo off
g:
cd \water
acctest *.fil
if errorlevel 2 goto missing_files
if errorlevel 1 goto in_use
water02
goto end
:in_use
echo The water system is presently in use. Please try again later.
goto end
:missing_files
echo Please tell the System Administrator that necessary data files
echo are missing. He will let you know when the system will be ready
echo for use.
goto end
:end
.
.
.

This batch file will run a program called water02 if all files
matching g:\water\*.fil are available. If the files are unavailable
or don't exist, an appropriate message is printed.


Comments, suggestions, etc
--------------------------
This program (acctest), but not its source code is released into the
public domain. If you have comments or suggestions, you may contact
me via:

Calvin A. Curtindolph
1434 W. Carmen
Chicago, IL 60640

Executive Region BBS: 312-267-4749 (IL)

Tool Shop BBS: 602-279-2673 (AZ)

Computer Connections BBS: 202-547-7621 (DC)

Motherboard BBS: 707-778-8841 (CA)

Compu$erve 72060,3717

I log onto CI$ very infrequently; BBS messages will be answered
faster. Also, I am not sysop of any of the above mentioned BBSs; they
are just systems I call fairly often.



 December 17, 2017  Add comments

Leave a Reply