9

I am trying to copy files from server to another server every hour as files being created. I was using Robocopy for copying file, and its very useful. But now I am really stuck with this. I need to copy files with MINAGE value of minutes, something like that.

if i ran robocopy after 2pm, i should able to copy only file which created before 2PM

Robocopy MAXAGE and MINAGE only accepts date not time.

Any suggestion

Josh
  • 1,009
  • 2
  • 13
  • 25
  • Please describe the problem you're trying to solve instead of what you perceive as the solution. Why do you want to prevent files newer than x minutes from being copied? – Ansgar Wiechers Jun 24 '13 at 22:51
  • coz if i need to cut copy to more than one server and only same files should be moved to all servers – Josh Jun 25 '13 at 13:58
  • Are all source files in the same directory? Must all files remain in the directory they're created in? – Ansgar Wiechers Jun 25 '13 at 14:39
  • Files all from same directory and should move (meant copy and delete from source directory). why I needed in hh:mm ways, when first server copy may takes few minutes and when it go for second server copy, there might be more files been created and that case second server of course have more files than the first server to copy – Josh Jun 25 '13 at 15:42
  • Then I'd suggest a 2-step approach: move modified files to a staging directory on the same filesystem before distributing them to the servers (from the staging directory). – Ansgar Wiechers Jun 25 '13 at 17:07

3 Answers3

1

Why u don't use the MIR function and run the job every 60 min via task scheduler?

Another way could be: /mot: Monitors source, and runs again in M minutes if changes are detected.

My last resort (non robocopy way):

Copy-Item c:\src\*.* -filter (Get-ChildItem | Where{$_.CreationTime -ge (Get-Date).AddMinutes(-60)}) "C:\dest\"

You could that even run via task scheduler

  • I agree if you want to get specific with the copy filter then a PowerShell script is probably a good option unless you're dealing with a very large file set and need the Robocopy performance. – logicaldiagram Nov 26 '19 at 15:52
-3

xxcopy has better granularity in date/time.

foxidrive
  • 40,353
  • 10
  • 53
  • 68
-4

MINAGE and MAXAGE refer to the creation date of the file.

MINLAD and MAXLAD refer to the last write time of the file.

Use a combination of both.

Source: http://social.technet.microsoft.com/Forums/scriptcenter/en-US/b5cb685e-32f6-4eed-855d-e710ca4b203f/what-is-the-date-in-robocopys-minage-

tcables
  • 1,231
  • 5
  • 16
  • 36
  • 4
    MINLAD and MAXLAD refer to the Last Access Date. MINAGE and MAXAGE refer to the last modification date (i.e. the last write time). – Ansgar Wiechers Jun 24 '13 at 22:39
  • 3
    My mistake, that's what i get for trusting windows forums without checking their answers. – tcables Jun 25 '13 at 15:09