I need a Windows batch code to find the last modified file among all the files in all the subfolders of a specific folder.
It doesn't seem to be so simple as it appears.
Some files could have been modified in the same minute, but in different seconds. I need only the lastest one.
This code uses
robocopy
(native for Vista and later OS versions, downloadable from Microsoft for XP or 2003) to obtain a list of files with timestamp inyyyy-mm-dd hh:nn:ss
format, that is sorted in decreasing order and then only the first line (that is, the newer file) is retrieved.