safely lock a file then move? windows
- by acidzombie24
I have a file and need to ensure it exist before inserting a row into the db. After i insert i need to use the PK as part of the filename and move it into another location.
How do i check if it exist then lock it so it cant be deleted until i can insert into the db then proceed to move the file without it being deleted upon releasing the lock?
also the file may be in use. I am thinking of copying the file into a safe location then moving that file away. In this case i need to copy a file that is being used for reading. How can i do the above steps safely?
Using .NET