Link to home
Start Free TrialLog in
Avatar of Bulle
BulleFlag for Switzerland

asked on

Copy locked files with Robocopy using /B parameter

Hello,
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
Avatar of johnb6767
johnb6767
Flag of United States of America image

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

Backup of open files
http://www.kiesoft.com/123b/manual/ofb.htm

Robocopy does support the /c swithc which allows continuing on errors but that kinda defeats the purpose of a backup in the first place.....
There are other methods of backing up .pst files though.....

Script to schedule your pst-file back-up
http://www.howto-outlook.com/downloads.htm

Download details: Outlook 2003/2002 Add-in: Personal Folders Backup
http://www.microsoft.com/downloads/details.aspx?FamilyId=8B081F3A-B7D0-4B16-B8AF-5A6322F4FD01
Robocopy cannot copy locked files - try syncback if you want a nice ptogram that can http://www.2brightsparks.com/syncback/syncback-hub.html
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...

http://www.pluralsight.com/blogs/craig/archive/2006/09/20/38362.aspx
ASKER CERTIFIED SOLUTION
Avatar of ajbritton
ajbritton
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bulle

ASKER

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 (http://ccollomb.free.fr/unlocker/), 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?

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.
Avatar of Bulle

ASKER

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 http://blogs.msdn.com/adioltean/archive/2005/01/05/346793.aspx) 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.
Glad to hear that you got it sorted.
Avatar of amit_ary
amit_ary

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: www.amitchaudhary.com
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.  http://www.gurusquad.com



Good Luck