파일을 주기적으로 백업하는 배치 파일 등을 작성하다 보면 날짜를 계산하거나 특정 파일에 저장된 날짜를 읽어들여 그 날짜를 비교하여 어떤 작업을 해야될 경우가 종종 발생합니다.

그래서 만들어 보았습니다.

DateCompare날짜를 비교한 결과를 errorlevel에 기록합니다.
배치파일에서 errorlevel의 값을 비교하여 특정 작업을 처리할 수 있습니다.
결과를 화면에 표시하기 위해서는 /d 옵션을 사용하면 됩니다.
인자로 날짜가 아닌 파일명을 줄 경우 해당 파일의 내용을 읽어서 비교합니다.
날짜 형식은 YYYY-MM-DD hh:nn:ss 또는 YYYY-MM-DD hh:nn:ss.mi 입니다.

DateCompare, ver. 1.0 (c) isulnara.com

Syntax: DateCompare [option] date1 date2
           DateCompare [option] file1 file2

Option start with – or /
  -d        show debug output
  -h or -?  show this help

errorlevel:   0 -> date1 < date2
                 1 -> date1 = date2
                 2 -> date1 > date2
              255 -> date format error

Example: DateCompare /d “2009-03-07 16:24:17” “2009-03-07 16:51:17”
              DateCompare /d c:\version1.txt c:\version2.txt
              if errorlevel 255 goto ERROR
              if errorlevel 2 goto UPLOAD
              if errorlevel 1 goto END
              if errorlevel 0 goto DOWNLOAD

다운로드: DateCompare (https://isulnara.com/myAPP/console/DateCompare.exe)