25

We are using Robocopy to redistribute files which arrive via FTP in a drop folder. Ideally we want Robocopy to leave files alone if they are still being FTPd.

Having tried various switches, Robocopy still copies the open files. It doesn't delete them, so the FTP continues unaffected. However, we end up with truncated files being distributed to their destination.

Can Robocopy be made to skip open files?

Perhaps there is something more suitable than Robocopy for this task?

domspurling
  • 253
  • 1
  • 3
  • 5

4 Answers4

35

Have you tried using the /R and /W switches?

Something like:

/R:2 /W:2 

This means retry twice wait 2 secs to retry. If the file is still open after the two attempts, the file will be skipped. Depending on your needs you could lower it to /R:1 /W:1.

bmurtagh
  • 763
  • 2
  • 6
  • 13
  • 3
    +1 - These are pretty much mandatory options if you want your robocopy to actually complete. – MDMarra Nov 01 '12 at 15:05
  • Shouldn't the /B and /Z switches be used here? – pauska Nov 01 '12 at 15:06
  • 6
    Thanks to pauska for the suggestion of the /B switch (backup mode). This tries to reset the archive bit on the file and so fails when the file is open. A combination of /B and /R /W is what worked for me in the end: robocopy ./test2 ./test1 /B /W:0 /R:0 – domspurling Nov 30 '12 at 12:37
1

My One worked as below:

ROBOCOPY \Source \Destination *.pst /SEC /S /B /R:2 /W:2 > C:\temp\robocopy.log

0

Can robocopy skip opened excel files? I have tried multiple methods and none seems to work. I wonder if it’s because robocopy can’t skip opened Excel files.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://serverfault.com/help/whats-reputation) you will be able to [comment on any post](https://serverfault.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/509826) – bjoster Jan 24 '22 at 13:35
-4

I use copyrite as it takes all the BS CLI stuff out of the equation. It's a gui that allows one to point and click a robocopy job.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92