Windows – Copy all files created after a specific hour in command line (Windows)

windows

I would like to easily copy a batch of files from one very big directory to another based on the hour of creation (every hour i want to copy the files from last hour).

I have used Xcopy /D function but you can only put the date but not the hour.

Is there another command? the directory is really big and it's very long to test each file for it's creation date in a Script. Xcopy is great but lacks the hour.

Best Answer

Robocopy will do the job, assuming you can specify a file from the previous hour's copy as a timestamp -- something like

robocopy <source> <destination> * /XO <file-from-an-hour-ago> <filespec-to-copy>

should do the trick, with a bit of tweaking. Hope this helps!

Edited to add: On a pre-Vista box you may need to download Robocopy, which as far as I know is best obtained in the Server 2003 Resource Kit Tools download; as far as I'm aware, Vista and newer should have Robocopy installed by default and present in your path.