I have a directory in which the sub-directory complex tree has many files.
If I try to move that directory to another directory on the same partition, that operation can theoretically take time - rename operation, basically - as long as the source directory No files are in use and there are no security problems, okay?
If so, how would I tell the program if it is possible to transfer directory A to B?
Is there a locking related API that can help me with this?
I am using C # on NTFS partitions.
Such "this work" APIs are not present on a multi-operating system, they are embedded incredible , Such as checking whether a file is locked or not. Such a test can return "no lock", then your thread may be pre-blank and lock another thread file in another process. When your thread comes back to the CPU, you will know that the file is locked, even if the test said that it was not.
The only way to do this is to actually do the operation, then see that it was not possible to indicate an error in C #, try to catch IOException statement. It is not easy to deal with, but at least NTFS allows you to rename or move the file that is locked.
Comments
Post a Comment