home *** CD-ROM | disk | FTP | other *** search
-
- DATEWARN.DOC - Documentation for DateWarn version 1.04 17/11/1991
-
- Documentation and executable code Copyright (c) 1991 Michael E. Ralphson
-
-
- Disclaimer:
- ===========
-
- The Author retains copyright in that he alone has the right to make copies for
- profit. In all other respects users may treat this software as if it were in
- the Public Domain, as long as the package is distributed whole and unmodified.
-
- In my opinion this software is perfectly safe and is free of any serious bugs,
- however I have to make it clear that use of this software constitutes the
- user's full acknowledgement that the author takes no responsibility WHATSOEVER
- for the consequences of such use.
-
- Commercial users must register within 30 days if they wish to continue using
- this software. For non-commercial users registration is purely voluntary. See
- enclosed Register.Txt for more details.
-
-
- Introduction:
- =============
-
- DateWarn is a simple program that works out how old a specified file is in
- days and compares this to a user-specified value. DateWarn displays on screen
- the age of the specified file in days and if this is greater or equal to the
- number of days specified on the command-line it halts with a DOS ErrorLevel of
- 1 (which can be tested for in a batch file). If the file could not be found,
- DateWarn exits with an ErrorLevel of 2, in all other circumstances DateWarn
- exits with an ErrorLevel of 0.
-
-
- Usage:
- ======
-
- DateWarn <file to check> <number of days>
-
- If, for example, DateWarn was run with the following command-line:
-
- DateWarn lastback.up 14
-
- Assume that the file LASTBACK.UP was created on the 3rd of February 1991 and
- the program is run on the 17th of February 1991.
-
- The output from DateWarn is:
-
- C:\LASTBACK.UP is dated 14 days ago.
-
- And then the program exits with an ErrorLevel of 1 to show that the condition
- was satisfied.
-
-
- A Practical Example:
- ====================
-
- Consider this example AUTOEXEC.BAT:
-
- @ECHO OFF
-
- REM Run all the normal start-up programs
-
- PROMPT $P$G
- PATH C:\;C:\DOS;C:\BAT;
- KEYB UK
-
- REM Make sure battery backed clock has not reset.
-
- 1980TEST
- IF ERRORLEVEL 1 GOTO NEWDATE
-
- :RETURN
-
- REM Was the last backup more than a week ago?
-
- DATEWARN LASTBACK.UP 7
- IF ERRORLEVEL 2 GOTO BACKUP-F
- IF ERRORLEVEL 1 GOTO BACKUP-I
- GOTO END
-
- :NEWDATE
-
- DATE
- TIME
- GOTO RETURN
-
- :BACKUP-F
-
- REM Run full backup
-
- CD\BACKUP
- BACKUP /F
- CD\
- GOTO UPDATE
-
- :BACKUP-I
-
- REM Run back-up software in incremental mode.
-
- CD\BACKUP
- BACKUP /I
- CD\
-
- :UPDATE
-
- REM Create a new file LASTBACK.UP with today's date
-
- ECHO This file is used by DateWarn.Exe>LASTBACK.UP
-
- :END
-
-
- The important parts to note are:
-
- 1) The test for the ErrorLevel is performed IMMEDIATELY after DateWarn is run.
-
- 2) The Backup section of the batch file creates a new LASTBACK.UP file, thus
- ensuring it has today's date. If your backup software creates or updates a
- file every time it is run, you can use this instead of LASTBACK.UP and
- remove the ECHO ... >LASTBACK.UP line.
-
- 3) The user is asked to enter the date if the battery backed clock resets (most
- reset to 1st January 1980) because of battery failure. 1980TEST.COM is
- included in this archive.
-
-
- Version History:
- ================
-
- 1.03 - May 91 Initial version
- 1.04 - Nov 91 ErrorLevel dropped if file doesn't exist
-
-
- Thanks To:
- ==========
-
- Edward Devlin and Mark Cracknell.
-