To see the answer, type:
dir <Drive:>\Folder\FileName.ext /N /O:D /T:A
To return the answer in the LstADte environment variable, in YYYYMMDD format:
call LastADte <Drive:>\Folder\FileName.ext
where LastADte.bat contains:
@echo off set LstADte= setlocal if not exist %1 goto syntax for /f "Skip=4 Tokens=1-5* Delims=/ " %%a in ('dir %1 /N /O:D /T:A') do call :file %%a %%b %%c %%d %%e %%f endlocal & set LstADte=%LstADte% goto end :syntax @echo File Not Found: %1 endlocal goto end :file if "%6"=="" goto end set FMM=%1 set FDD=%2 set FYY=20%3 if "%3" GTR "69" set FYY=19%3 set LstADte=%FYY%%FMM%%FDD% :endTo archive based upon Last Access Date, modify the last Dir in JSIOLD.BAT From:
for /f "Tokens=1-4* Delims=/ " %%a in ('dir %1 /N') do call :jsioldd %1 %%a %%b %%c %%d %%e to for /f "Tokens=1-4* Delims=/ " %%a in ('dir %1 /N /O:D /T:A') do call :jsioldd %1 %%a %%b %%c %%d %%e
0 comments
Hide comments