timestamp - Find last modified file in all subfolders -
i need windows batch code find lastly modified file among files in subfolders of specific folder.
it doesn't seem simple appears.
some files have been modified in same minute, in different seconds. need lastest one.
class="lang-dos prettyprint-override">@echo on setlocal enableextensions disabledelayedexpansion set "root=c:\somewhere" %%r in ("%root%\.") /f "tokens=3,*" %%a in (' robocopy "%%~fr." "%%~fr." /l /nocopy /s /is /njh /njs /ndl /nc /ns /ts ^| sort /r ^| findstr /n "^" ^| findstr /l /b /c:"1:" ') echo %%b
this code uses robocopy
(native vista , later os versions, downloadable microsoft xp or 2003) obtain list of files timestamp in yyyy-mm-dd hh:nn:ss
format, sorted in decreasing order , first line (that is, newer file) retrieved.
batch-file timestamp batch-processing last-modified datemodified
No comments:
Post a Comment