I want to copy the latest file from a Folder and its subfolders to a new location.
The following code works well, BUT I do not want to filter by Date AND Time (/O:D), but DATE only, so that all latest files from the same date will be copied to the new location as the latest files.
FOR /F "delims=|" %%I IN ('DIR "D:\Backups\DB\*.bak" /B /O:D /S') DO SET NewestFile=%%I
copy "%NewestFile%" "D:\Backups\DB\Latest"