Skip to content

Commit cdfe8aa

Browse files
authored
Update Directory.Move remarks (dotnet#7617)
1 parent 5cb0af2 commit cdfe8aa

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

xml/System.IO/Directory.xml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4006,27 +4006,29 @@ An I/O error occurred.</exception>
40064006
</Parameters>
40074007
<Docs>
40084008
<param name="sourceDirName">The path of the file or directory to move.</param>
4009-
<param name="destDirName">The path to the new location for <paramref name="sourceDirName" />. If <paramref name="sourceDirName" /> is a file, then <paramref name="destDirName" /> must also be a file name.</param>
4009+
<param name="destDirName">The path to the new location for <paramref name="sourceDirName" /> or its contents. If <paramref name="sourceDirName" /> is a file, then <paramref name="destDirName" /> must also be a file name.</param>
40104010
<summary>Moves a file or a directory and its contents to a new location.</summary>
40114011
<remarks>
40124012
<format type="text/markdown"><![CDATA[
40134013
4014-
## Remarks
4015-
This method creates a new directory with the name specified by `destDirName` and moves the contents of `sourceDirName` to the newly created destination directory. If you try to move a directory to a directory that already exists, an <xref:System.IO.IOException> will occur. For example, an exception will occur if you try to move c:\mydir to c:\public, and c:\public already exists. Alternatively, you could specify "c:\\\public\\\mydir" as the `destDirName` parameter, provided that "mydir" does not exist under "c:\\\public", or specify a new directory name such as "c:\\\newdir".
4014+
## Remarks
4015+
4016+
This method creates a new directory with the name specified by `destDirName` and moves the contents of `sourceDirName`, including files and directories, to the newly created destination directory. It then deletes the `sourceDirName` directory.
4017+
4018+
If you try to move a directory to a directory that already exists, an <xref:System.IO.IOException> will occur.
40164019
4017-
The `sourceDirName` and `destDirName` arguments are permitted to specify 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>.
4020+
The `sourceDirName` and `destDirName` arguments are permitted to specify 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>.
40184021
4019-
Trailing spaces are removed from the end of the path parameters before moving the directory.
4022+
Trailing spaces are removed from the end of the path parameters before moving the directory.
40204023
4021-
For a list of common I/O tasks, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
4022-
4024+
For a list of common I/O tasks, see [Common I/O Tasks](/dotnet/standard/io/common-i-o-tasks).
40234025
40244026
> [!NOTE]
4025-
> Starting with .NET Core 3.0, the `Move` method throws an <xref:System.IO.IOException> in all platforms when the `destDirName` already exists. In .NET Core 2.2 and previous versions, the exception was only thrown on Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename).
4026-
4027-
4027+
> Starting with .NET Core 3.0, the `Move` method throws an <xref:System.IO.IOException> in all platforms when the `destDirName` already exists. In .NET Core 2.2 and previous versions, the exception was only thrown on Windows, and other platforms could either fail or overwrite the `destDirName`. See [C++ rename](https://linux.die.net/man/2/rename).
4028+
40284029
## Examples
4029-
The following example demonstrates how to move a directory and all its files to a new directory. The original directory no longer exists after it has been moved.
4030+
4031+
The following example demonstrates how to move a directory and all its files to a new directory. The original directory no longer exists after it has been moved.
40304032
40314033
:::code language="csharp" source="~/samples/snippets/csharp/System.IO/Directory/Overview/class6.cs" id="Snippet14":::
40324034
:::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Directory/VB/class6.vb" id="Snippet14":::
@@ -4037,7 +4039,7 @@ An I/O error occurred.</exception>
40374039

40384040
-or-
40394041

4040-
<paramref name="destDirName" /> already exists. See the Note in the Remarks section.
4042+
<paramref name="destDirName" /> already exists. See the note in the Remarks section.
40414043

40424044
-or-
40434045

0 commit comments

Comments
 (0)