Disclaimer: I immediately admit that I have quite a lot of ignorance regarding the details of how file systems work. I have been using NTFS for so long that I can extrapolate what happens based on the behavior I observed, as well as everything that I learned from dorking on the Internet - however ...
I was hoping there was a way to detect if, when moving a file from "location A" to "location B", whether the operation would require the equivalent of "File.Copy → File.Delete" or if it does not copy the actual data of the file, but simply updates the location in the "main file table", etc.
For various purposes, I sometimes move a large number of large files. I like to report progress in the user interface.
I understand that when I call File.Move and move the file from one place to one drive / partition to another, the function will effectively "copy file data → delete" between drives / partitions. When he encounters this situation, I want to know that this will happen, so I can use the code I created that will copy the file and provide a detailed progress report as the bytes are transmitted, so that I can update progress indicators in the user interface often .
When it is on the same drive / partition, since updating the location in the main file table is so fast, I just update the progress bar when the file.Move function completes for every file I move with.
Using .NET 4 (C #), is it possible to detect using other means whether the File.Move call requires the equivalent operation “copy → delete” or simply updates the file table rather than copying the file data?
Edit:
As I noted in the comments below, the possibilities of how I thought this could be done is to determine whether the location of the source file and the location of the target file are on the same physical disk and partition, and if so, it would mean I could accurately predict the behavior and decide which functions to call - the built-in File.Move function for the "file system of the file system", which, it seems to me, occurs when moving to the same disk / part or my more detailed report about each 'x' bytes copied 'copy code n stom file. File transfer speeds can vary greatly on the machines on which my programs will run, so I would like to report on the results achieved / current transfer speed when possible.
Note. The program can use network UNC paths that can use different physical disks with one root path, that is: \\ somename \ shares \ workfolder \ project can be on another physical disk, and then \\ somename \ shares \ workfoldder \ otherproject. Therefore, I need a method for detecting a partition identifier or physical disk identifier to find out if the source and destination folders are on the same drive / partition.
thanks