You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Better document File.Move across disk volumes. (dotnet#5249)
* Better cover File.Move across disk volumes.
Currently the documentation claims that IOException is only thrown if `destFileName` exists. This is not true - moving across disk volumes involves copying and opens various IOException possibilities, e.g. "no space left on device".
* Apply suggestions from code review
Co-authored-by: Konstantin Gukov <[email protected]>
Co-authored-by: Adam Sitnik <[email protected]>
Copy file name to clipboardExpand all lines: xml/System.IO/File.xml
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2518,6 +2518,8 @@ Note that if you attempt to replace a file by moving a file of the same name int
2518
2518
2519
2519
The `sourceFileName` and `destFileName` arguments can include relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see <xref:System.IO.Directory.GetCurrentDirectory%2A>.
2520
2520
2521
+
Moving the file across disk volumes is equivalent to copying the file and deleting it from the source if the copying was successful.
2522
+
2521
2523
If you try to move a file across disk volumes and that file is in use, the file is copied to the destination, but it is not deleted from the source.
2522
2524
2523
2525
For a list of common I/O tasks, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
@@ -2534,6 +2536,10 @@ The following example moves a file.
2534
2536
</remarks>
2535
2537
<exceptioncref="T:System.IO.IOException">
2536
2538
<paramrefname="destFileName" /> already exists.
2539
+
2540
+
-or-
2541
+
2542
+
An I/O error has occurred, e.g. while copying the file across disk volumes.
@@ -2595,6 +2601,8 @@ This method works across disk volumes, and it does not throw an exception if the
2595
2601
2596
2602
The `sourceFileName` and `destFileName` arguments can include relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see <xref:System.IO.Directory.GetCurrentDirectory%2A>.
2597
2603
2604
+
Moving the file across disk volumes is equivalent to copying the file and deleting it from the source if the copying was successful.
2605
+
2598
2606
If you try to move a file across disk volumes and that file is in use, the file is copied to the destination, but it is not deleted from the source.
2599
2607
2600
2608
For a list of common I/O tasks, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
@@ -2611,6 +2619,10 @@ The following example moves a file.
2611
2619
</remarks>
2612
2620
<exceptioncref="T:System.IO.IOException">
2613
2621
<paramrefname="destFileName" /> already exists and <paramrefname="overwrite" /> is <seelangword="false" />.
2622
+
2623
+
-or-
2624
+
2625
+
An I/O error has occurred, e.g. while copying the file across disk volumes.
0 commit comments