Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for clonedate.bat

(view source code of clonedate.bat as plain text)

  1. @ECHO OFF
  2. :: Check Windows version
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4. VER | FIND.EXE /I "Windows NT" >NUL && GOTO Syntax
  5.  
  6. :: Check if two valid files are specified
  7. IF NOT EXIST "%~2" GOTO Syntax
  8. IF NOT EXIST "%~1" GOTO Syntax
  9.  
  10. :: Check if REGINA.EXE and FILEDATE.REX are available
  11. IF NOT EXIST "%~dp0FileDate.rex" GOTO Syntax
  12. REGINA.EXE -? >NUL 2>&1 || GOTO Syntax
  13.  
  14. :: Apply the source file's timestamp to the target file
  15. FOR /F "tokens=1,2" %%A IN ('ECHO.%~t1') DO REGINA.EXE "%~dp0FileDate.rex" "%2" /D%%A /T%%B
  16.  
  17. :: Done
  18. GOTO:EOF
  19.  
  20.  
  21. :Syntax
  22. ECHO.
  23. ECHO CloneDate.bat,  Version 1.11 for Windows 2000 and later
  24. ECHO Apply the first file's timestamp to the second file specified
  25. ECHO.
  26. ECHO Usage:  CLONEDATE  sourcefile  targetfile
  27. ECHO.
  28. ECHO Where:  sourcefile is the file whose timestamp is read
  29. ECHO         targetfile is the file the retrieved timestamp is applied to
  30. ECHO.
  31. ECHO Note:   This batch file uses Regina Rexx and my FILEDATE.REX script to change
  32. ECHO         the target file's timestamp. FILEDATE.REX must be in the same directory
  33. ECHO         where this batch file is located, and REGINA.EXE should be in the PATH.
  34. ECHO.
  35. ECHO Written by Rob van der Woude
  36. ECHO http://www.robvanderwoude.com
  37.  

page last modified: 2024-04-16; loaded in 0.0185 seconds