OS: Windows 7 x64 (HomePremium) CMD: >robocopy [source] [destination] -options

$ robocopy "C:\Users\itzme\AppData\Roaming\Mozilla\Firefox\Profiles\geo2eich.default" "E:\download\internet\firefox\geo2eich.default" /MIR /SEC

I use Robocopy within Windows to backup my files/drives. The problem is that i'm receiving errors for destinations that are currently in-use such as (examples of which files are in-use during scheduled run include):

Foobar2000 (portable): _running-file

Firefox: parent.lock-file

Because I have this task scheduled to run daily I most likely have these programs up and running by the time of the scheduled-run, so it conflicts consistently.

So my question is, is there a way to by-pass files that can't be copied? Because in this particular situation I don't need to backup these 'live-files' they don't contain any significant data that I atleast need anyways.

  • 1
    Are you able to post the robocopy options you are using? – tyelford Dec 2 '15 at 0:47
  • 1
    @PJMahoney, I've added the command along with it's parameters in the original post (only of which include /MIR & SEC. It seems I could just retry it once & have it wait very shortly with /R:1 /W:1 – fohrums Dec 2 '15 at 5:30

Be sure to use the /R:<number of retry> and /W:<time before next retry> options. If the destination you are transferring to is on a network or unstable type of storage you can add more retry times and increase the wait. However I have found that the usual /R:1 and /W:1 works fine in most cases. If you don't specify these options the default retry is 1 million and default wait time is 30 seconds (holy cow!)

I would also be very careful of the /MIR option. This will make an exact copy of the source to the destination. If you run this command a second time and the source files have changed it will make another EXACT copy. This becomes a problem if you delete a file from the source and wanted to keep that one on the destination (say a backup history of types), the /MIR option will remove the file from the destination.

A Better way is to use the /E option instead of /MIR. It basically does the same thing but keeps files in the destination unless they are over written.

Since you have also used the /SEC option, this may not actually keep file persmission in tack. In addition I would include /SECFIX. I've used this when migrating users home folders on servers and the permissions kept with /SEC /SECFIX

Lastly you can create a log file to view the results after the command has finished with. First choice, create a new log file /LOG:<filename>, second choice, append to the end of an exisiting log file /LOG+:<filename>

My suggested full command would be

robocopy "C:\Users\itzme\AppData\Roaming\Mozilla\Firefox\Profiles\geo2eich.default" "E:\download\internet\firefox\geo2eich.default" /E /R:1 /W:1 /SEC /SECFIX /LOG+:"C:\temp\robocopy.log"

Here is a link to the full robocopy documenation from MS: https://technet.microsoft.com/en-us/library/cc733145.aspx

Or at a command line just run robocopy /? and it will output the options. The output looks a bit daunting at first but you will soon see that it is split into sections, ie COPY OPTIONS, RETRY OPTIONS, etc.

Good luck

  • Thanks for the tip, i've not switched to /E rather than /MIR. I've managed to by-pass the files that were in-use with the /R: & /W: parameters and am now able to successfully backup my files. BUT, as far as logging goes, why do people prefer it to be in ~/temp? Wouldn't that directory be flushed after a pc-restart? – fohrums Dec 3 '15 at 3:11
  • I just used the temp directory as an example. If you were going to backup often you might want to make a dedicated directory for the log files. I guess sometimes you would just quickly review the log and then not need to see it again. This is all personal preference though. – tyelford Dec 3 '15 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.