Description: |
call:CmpFTime op file1 file2 attr1 attr2 |
Script: |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25.
|
:CmpFTime op file1 file2 attr1 attr2 -- compares the time of two files, succeeds if condition is met, fails otherwise
:: -- op [in] - compare operator, see 'IF /?', i.e.EQU, NEQ, LSS, LEQ, GTR, GEQ
:: -- fileL [in] - file name, left side of comparisation
:: -- file2 [in] - file name, right side of comparisation
:: -- attrL [in,opt] - time field to be used for fileL, see 'dir /?', i.e. /tc, /ta, /tw, default is /tw
:: -- attrR [in,opt] - time field to be used for fileR, default is attrL
:$created 20060101 :$changed 20080219 :$categories DateAndTime,FileOperation
:$source https://www.dostips.com
SETLOCAL
set op=%~1
set fileL=%~2
set fileR=%~3
set attrL=%~4
set attrR=%~5
if "%op%"=="" set op===
if "%attrL%"=="" set attrL=/tw
if "%attrR%"=="" set attrR=%attrL%
for /f "tokens=1-6 delims=/: " %%a in ('"dir %attrL% /-c "%fileL%"|findstr "^^[0-1]""') do (
set TL=%%c%%a%%b%%f%%d%%e
)
for /f "tokens=1-6 delims=/: " %%a in ('"dir %attrR% /-c "%fileR%"|findstr "^^[0-1]""') do (
set TR=%%c%%a%%b%%f%%d%%e
)
if "%TL%" %op% "%TR%" (rem.) ELSE set=2>NUL
EXIT /b
|
|