Is there a way to unload, detach, or close a file from an application such that the parent directory can be moved without problems?
Yes. Refer the
File Management Functions in MSDN.
How does the application/OS recognize that it cannot move the active file?
When an application opens the file, the programmer can set various sharing access rights so that the OS knows what to do when a request that affects the same file comes while that file is still open. You can see the list of flags that can be set under the Security Attributes section for CreateFile.
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
Offline 1,559 posts
since Jun 2005