I want to copy one file that is the newest in whole catalog. How to do it using robocopy? I know /xo and /xn options but it doesn't do what I need.
migrated from stackoverflow.com Mar 28 '13 at 0:22
This question came from our site for professional and enthusiast programmers.
Interesting idea, does it have to be done with RoboCopy?
I would try something like this using PowerShell:
So to do that in robocopy, you can just use the (Get-ChildItem -Path Path:\to\files\here -Recurse -File | Sort-Object -Descending LastWriteTime) part and set it to a variable, and pass it in to a RoboCopy line.
Robocopy is good for mirroring and transferring lots of files/directories, but it doesn't do delta style copies so it might not be the best for this situation. I also took a guess you meant last file written to, you could use LastAccessTime if that fits better.