Solved

Copy locked files with Robocopy using /B parameter

Posted on 2007-06-26
68,405 Views
Last Modified: 2012-11-09
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
0
Question by:Bulle
    13 Comments
     
    LVL 66

    Expert Comment

    by:johnb6767
    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.....
    0
     
    LVL 66

    Expert Comment

    by:johnb6767
    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
    0
     
    LVL 26

    Expert Comment

    by:farhankazi
    0
     
    LVL 70

    Expert Comment

    by:KCTS
    Robocopy cannot copy locked files - try syncback if you want a nice ptogram that can http://www.2brightsparks.com/syncback/syncback-hub.html
    0
     
    LVL 8

    Expert Comment

    by:ajbritton
    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
    0
     
    LVL 8

    Accepted Solution

    by:
    There is also this (http://blogs.msdn.com/adioltean/archive/2006/09/18/761515.aspx) which is a bit complex, but could be useful to someone with the same problem who is handy in the scripting field.
    0
     

    Author Comment

    by:Bulle
    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?

    0
     
    LVL 8

    Expert Comment

    by:ajbritton
    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.
    0
     

    Author Comment

    by:Bulle
    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.
    0
     
    LVL 8

    Expert Comment

    by:ajbritton
    Glad to hear that you got it sorted.
    0
     

    Expert Comment

    by: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
    0
     
    LVL 16

    Expert Comment

    by:t0t0
    0
     
    LVL 5

    Expert Comment

    by:onlinerack
    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
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This article is an update and follow-up of my previous article:   Storage 101: common concepts in the IT enterprise storage This time, I expand on more frequently used storage concepts.
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    This tutorial will show how to inventory, catalog, and restore media from legacy versions of Backup Exec into both 2012 and 2014 versions of the software. Select Storage from the tabs along the ribbon bar as the top: Ensure the proper storage devi…
    This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

    884 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now