Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for modified.cmd

(view source code of modified.cmd as plain text)

  1. @ECHO OFF
  2. REM * MODIFIED.CMD
  3. REM * Check if specified file was created or modified today
  4. REM * OS/2 version
  5. REM * Written by Rob van der Woude
  6.  
  7. REM * Needs write access to current directory; or add fully qualified
  8. REM * path to files CURRENT.CMD and its language dependent versions,
  9. REM * and make sure its path is specified in the PATH variable.
  10.  
  11. REM * File name should be specified
  12. IF "%1"=="" GOTO Syntax
  13. IF NOT EXIST %1 GOTO Syntax
  14.  
  15. REM * Send DIR output for specified file to primary temporary
  16. REM * batch file to get the file's creation or modification date
  17. DIR %1 | FIND /I "%1" > %TEMP%.\~ISMODIF.TMP
  18. ECHO.>> %TEMP%.\~ISMODIF.TMP
  19. TYPE %TEMP%.\~ISMODIF.TMP | TIME | FIND /I "%1" > %TEMP%.\~ISMODIF.CMD
  20. REM * Create secondary temporary batch files to be called by primary
  21. ECHO SET CHKDATE=%%4>ENTER.CMD
  22. REM * For Dutch DOS versions
  23. ECHO SET CHKDATE=%%5>VOER.CMD
  24. ECHO SET CHKDATE=%%6>TYP.CMD
  25. CALL %TEMP%.\~ISMODIF.CMD
  26.  
  27. REM * Send DIR output for temporary batch file to itself to get today's date
  28. DIR %TEMP%.\~ISMODIF.CMD | FIND /I "~ISMODIF.CMD" > %TEMP%.\~ISMODIF.TMP
  29. ECHO.>> %TEMP%.\~ISMODIF.TMP
  30. TYPE  %TEMP%.\~ISMODIF.TMP | TIME | FIND /I "~ISMODIF.CMD" > %TEMP%.\~ISMODIF.CMD
  31. REM * Create secondary temporary batch files to be called by primary
  32. ECHO SET NOWDATE=%%4>ENTER.CMD
  33. REM * For Dutch DOS versions
  34. ECHO SET NOWDATE=%%5>VOER.CMD
  35. ECHO SET NOWDATE=%%6>TYP.CMD
  36. CALL %TEMP%.\~ISMODIF.CMD
  37.  
  38. REM * Compare dates and display result
  39. IF "%NOWDATE%"=="%CHKDATE%" ECHO %1 was created or modified today (%NOWDATE%)
  40.  
  41. REM * Clean up the mess
  42. DEL %TEMP%.\~ISMODIF.CMD
  43. DEL %TEMP%.\~ISMODIF.TMP
  44. DEL ENTER.CMD
  45. DEL VOER.CMD
  46. DEL TYP.CMD
  47. SET CHKDATE=
  48. SET NOWDATE=
  49. GOTO End
  50.  
  51. :Syntax
  52. ECHO MODIFIED.CMD
  53. ECHO Check if specified file was created or modified today
  54. ECHO OS/2 version
  55. ECHO Written by Rob van der Woude
  56. ECHO.
  57. ECHO.
  58. ECHO Usage:  %0  filename
  59.  
  60. :End
  61.  

page last uploaded: 2017-08-21, 14:26