Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Compare file date to current date  (Read 28233 times)

0 Members and 1 Guest are viewing this topic.

devcom



    Apprentice

    Thanked: 37
    Re: Compare file date to current date
    « Reply #30 on: October 27, 2008, 01:12:27 PM »
    try to put Mon 10/27/2008 in quotes ("")
    Download: Choice.exe

    silvrwood

      Topic Starter


      Rookie

      Re: Compare file date to current date
      « Reply #31 on: October 27, 2008, 01:33:03 PM »
      Thank you. 

       I ended up working through it prior to seeing your post, and I have successfully tested this:

      Code: [Select]
      @echo off

      :loop
      REM set variable to flag file mod date in sys format
      for /f "tokens=1,2" %%i in (C:\Admin\flag.txt) do (
         set dt=%%j
         )
      REM Create variable from sys date parsed to just mm/dd/yyyy
      for /f "tokens=1,2" %%i in ("%date%") do set sysdt=%%j
      REM compare flag mod date to sys date
      IF %dt% EQU %sysdt% GOTO indexer
      REM ECHO Not Equal
      REM dates not same so wait 10 minutes and try again
      ping -n 601 localhost > nul
      GOTO loop

      :indexer
      REM ECHO equal
      REM dates same so close Indexer
      CALL C:\Admin\EndIndex.bat
      REM wait for fileserver to come back up
      ping -n 901 localhost > nul
      REM start Indexer again
      CALL C:\Admin\StartIndex.bat

      EXIT



      Thanks to everyone for all your help!!!!

      Now, I just have to wait for an update initiated reboot to see if the script that writes to the flag file will run even with 3rd party initiated reboots.  If not, I'll be back to find out more about the suggestion to listen for the reboot event.