Click here to Skip to main content
16,012,759 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created a simple script in VB.NET which copies a file to a certain destination. But unfortunately my backup fails whenever the file is currently open by other user.

their OS is Windows XP
and i created my application using Visual Studio 2008.

Please please help...
thanks

What I have tried:

search for possible solution online
Posted
Updated 20-Sep-16 21:48pm

1 solution

If a file is locked, you can't access it under normal conditions.
It's possible that you can: Jim Scott's Coding Blog | How do I open a file that is in use in C#?[^] but I suspect it's going to depend on what mode the original file was opened for - if it's exclusive locked for writing then it may fail.
The alternative is heavy duty: Volume Shadow Copy Service (VSS)
This may help: GitHub - alphaleonis/AlphaVSS: AlphaVSS is a .NET class library released under the MIT license providing a managed API for the Volume Shadow Copy Service also known as VSS.[^] but don't expect it to be simple.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900