How to avoid XCopy run into the error: The process cannot access the file because it is being used by another process?

1

I am xcopying data from my local directory to a shared windows drive. Once in a while i get an issue where in the middle of copying i see the following error:

The process cannot access the file because it is being used by another process. Waiting 30 seconds . . .

Is there any way to force an overwrite as I can't figure out how to deal with this situation once it happens.

Any suggestions on how to deal with this issue?

leora

Posted 2011-12-29T04:40:59.797

Reputation: 5 353

Answers

2

Could you try using HobyCopy instead? It is a SourceForge project. Its description from there:

HoboCopy is a backup/copy tool. It is inspired by robocopy in both name and in functionality. It uses the Volume Shadow Service (VSS) to "snapshot" the disk before copying. It then copies from the snapshot rather than the "live" disk.

This should prevent any issues with locked / in-use files. This does assume that VSS is enabled ("Previous Versions") for the volume you're trying to copy from.

Some additional details about VSS are available at http://en.wikipedia.org/wiki/Shadow_Copy.

You can also find a number of tools that can be used to script VSS operations, including mounting to a drive letter / NTFS path, such that normal non-VSS-aware tools e.g. XCopy can still be used.

Alternatively, if you open the properties for a VSS-enabled drive, you should be able to use the "Open" option from the "Previous Versions" tab, and see a URL like \\localhost\C$\@GMT-2011.12.29-04.10.15. This URL may also possibly be useable by XCopy and other non-vSS-aware tools.

ziesemer

Posted 2011-12-29T04:40:59.797

Reputation: 844