Copy locked files with Robocopy using /B parameter

Posted on 2007-06-26
Last Modified: 2012-11-09
I want to use the robust file copy utility Robocopy to backup the workstation of my small office network.

The problem is this utility does not allow to copy files locked especially the files PST of Outlook.

I am amazed because Robocopy allows the parameter / B which makes a copy in backup mode. But even with this parameter I have an error " ERROR 32 ( 0x00000020 ) ".

What is necessary to make Robocopy able to copy locked files ?

Any help will be very appreciated
Question by:Bulle
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +5
LVL 66

Expert Comment

ID: 19365341
Robocopy doesnt copy open files, as you would need a normal Backup Software suite.

Backup of open files

Robocopy does support the /c swithc which allows continuing on errors but that kinda defeats the purpose of a backup in the first place.....
LVL 66

Expert Comment

ID: 19365367
There are other methods of backing up .pst files though.....

Script to schedule your pst-file back-up

Download details: Outlook 2003/2002 Add-in: Personal Folders Backup
LVL 26

Expert Comment

ID: 19365442
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

LVL 70

Expert Comment

ID: 19365787
Robocopy cannot copy locked files - try syncback if you want a nice ptogram that can

Expert Comment

ID: 19368109
If there is one thing I've learned in IT it's that everything is possible!

Craig Andera wanted to do the same sort of thing so he came up with his own solution based on the Volume Shadow Copies services built into Windows Server 2003 / XP. It is clearly indicated on Craig's site that this is a hobby project, but it may be worth a try and if it works...

Accepted Solution

ajbritton earned 460 total points
ID: 19368118
There is also this ( which is a bit complex, but could be useful to someone with the same problem who is handy in the scripting field.

Author Comment

ID: 19370405
Thanks to all for these answers,
I had already seen Hobocopy which seems to me be good solution. However I find the following defects to the program:
 1. / incremental require a file (via the parameter / statefile) and I do not know how to create this file the first time. Why the program does not look simply at the date of modification in the directory of destination to decide if the file must be copied or not ?
 2. We cannot exclude directories

I also discovered a freeware program which allows to unlock a file (, it is possible to use this program in a script to unlock a file before its copy.

But I would like to know the utility of the / B parameter in Robocopy. Why does this parameter exists?


Expert Comment

ID: 19371233
The /B tells robocopy to copy the file in 'backup' mode which is a special file access method designed to allow the backup of a file by users who do not have read access to the file.

I would not recommend unlocking a file prior to backing it up unless you are 110% sure the file will not be modified whilst it is being copied.

Looking at hobocopy, I think the the statefile is created for you when you do an initial copy, which would be necessary before attempting incrementals.

One messy (and probably slow) solution would be to write a script which processes the directory structure in a recursive way, calling hobocopy once at each directory level. You could then do your own filtering. I would think it probably easier to implement the method mentioned in my 2nd post though.

Author Comment

ID: 19479127
Hello everybody,
after spending hours to find what I was expeced, I finally found THE solution.
As explained in this blog by Adi Oltean, I use VShadow.exe to create shadow copy of my volume and map a drive letter (as explained in this blog before to access it with Robocopy. It was exactly what I expeced, using Robocopy with Volume Shadow Copy Service. Yet I've created an installer with NSIS which creates all the scripts and the scheduled task so each time I install a new machine I just have to launch the installer and everything is automatic.
I perhaps will use rsync instead of Robocopy to relieve network traffic. I will perhaps study this option later.
Many thanks to ajbritton who put me on the way to find the solution. I like the way you introduce your first answer : "If there is one thing I've learned in IT it's that everything is possible!" I totally agree with you, in IT everything is possible, it is only a question of patience and determination.

Expert Comment

ID: 19479203
Glad to hear that you got it sorted.

Expert Comment

ID: 21515133
try this...

CopySharp V1.0 is a GUI tool for copying open/in process files.
It is inspired by robocopy and vshadow.

CopySharp V1.0 requires Microsoft® Windows® Server 2003, Microsoft® Windows® XP

I have lots of issues posted over net regarding copying/renaming/moving of files fails due to the no of reasons like file is in process or opened by some application etc.

For example:
On going to the location of the .pst file, I can rename, but not copy or move. "Error 0x80070021: The process cannot access the file because another process has locked a portion of the file."

There are no processes using this file as I have tried to access the same file from another computer to the network drive. I have also tried to use "unlocking" tools which say the file is not locked by any process.

CopySharp addresses the same issue. And can easily copy the same kind of files.

Locate it at:
LVL 16

Expert Comment

ID: 23495131

Expert Comment

ID: 38584378
We have been through the same thing and after countless hours of evaluating different tools, we stumbled across gscopy pro.  It backs up open files and locked files with no issues.
Other utilities were a bit buggy in some way or shape but I guess this is what you get when it is free :(

Try gscopy pro.

Good Luck

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question