Backup/copy files that are in use or locked in Windows (command line)
Sometimes while you are copying a file to another destination and you can not do this because of an error message that says that the file is locked or is in use. Then there is another way to solve this problem.
As Windows XP supports a technology called Volume Shadow Copy that is very useful. It allows the previous editions in Vista as well as System Restore and backups. The mechanism on which it works is that it makes a temporary copy of the file or folders and then allows the application to read from that copy and act upon it as needed
We use command line application called HoboCopy that uses this service to copy the file.
Understand the basic idea:
HoboCopy along with many other backup utilities make use of two basic services in Windows, it is very important to check whether these services are active or not.
Volume Shadow Copy
Microsoft Software Shadow Copy Provider
If these both services are active then then Hobocopy will automatically do it work and turn off when the work will be done.
HoboCopy to Backup/Copy a Single File
HoboCopy is used for backing up a large number of folders. But It can also be used to backup a single file by passing its filename argument at the end of the command. Which is not an easy job to do
How to write the command:
This will help you to copy a file that is locked or in use. It is a little difficult but very powerful application and almost it give 100% positive result. The main thing is the syntax if you right the correct syntax to approach the file you can easily create the backup and then delete the file