FileSystemProxy.MoveDirectory Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Moves a directory from one location to another.
MoveDirectory(String, String) |
Moves a directory from one location to another. |
MoveDirectory(String, String, UIOption) |
Moves a directory from one location to another. |
MoveDirectory(String, String, Boolean) |
Moves a directory from one location to another. |
MoveDirectory(String, String, UIOption, UICancelOption) |
Moves a directory from one location to another. |
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
Moves a directory from one location to another.
public:
void MoveDirectory(System::String ^ sourceDirectoryName, System::String ^ destinationDirectoryName);
public void MoveDirectory (string sourceDirectoryName, string destinationDirectoryName);
member this.MoveDirectory : string * string -> unit
Public Sub MoveDirectory (sourceDirectoryName As String, destinationDirectoryName As String)
Parameters
- sourceDirectoryName
- String
Path of the directory to be moved.
- destinationDirectoryName
- String
Path of the directory to which the source directory is being moved.
Exceptions
The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \.\).
sourceDirectoryName
or destinationDirectoryName
is Nothing
or an empty string.
The directory does not exist.
The source is a root directory or The source path and the target path are the same.
The path exceeds the system-defined maximum length.
The operation is cyclic.
A file or directory name in the path contains a colon (:) or is in an invalid format.
The user lacks necessary permissions to view the path.
The user does not have required permission.
Examples
This example moves Directory1
inside Directory2
.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2")
This example moves Directory1
inside Directory2
, overwriting the directory if it already exists.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2",
True)
Remarks
If an attempt is made to move a directory inside a directory that does not exist, the target structure will be created.
See also
- MoveFile(String, String)
- CopyDirectory(String, String)
- Objects (Visual Basic)
- Creating, Deleting, and Moving Files and Directories in Visual Basic
Applies to
.NET Framework 4.8.1 og aðrar útgáfur
Vara | Útgáfur |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9 |
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
Moves a directory from one location to another.
public:
void MoveDirectory(System::String ^ sourceDirectoryName, System::String ^ destinationDirectoryName, Microsoft::VisualBasic::FileIO::UIOption showUI);
public void MoveDirectory (string sourceDirectoryName, string destinationDirectoryName, Microsoft.VisualBasic.FileIO.UIOption showUI);
member this.MoveDirectory : string * string * Microsoft.VisualBasic.FileIO.UIOption -> unit
Public Sub MoveDirectory (sourceDirectoryName As String, destinationDirectoryName As String, showUI As UIOption)
Parameters
- sourceDirectoryName
- String
Path of the directory to be moved.
- destinationDirectoryName
- String
Path of the directory to which the source directory is being moved.
- showUI
- UIOption
Specifies whether to visually track the operation's progress. Default is UIOption.OnlyErrorDialogs
.
Exceptions
The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \.\).
sourceDirectoryName
or destinationDirectoryName
is Nothing
or an empty string.
The directory does not exist.
The target directory already exists and overwrite
is set to False
.
The path exceeds the system-defined maximum length.
The operation is cyclic.
A file or directory name in the path contains a colon (:) or is in an invalid format.
The user lacks necessary permissions to view the path.
The user does not have required permission.
Examples
This example moves Directory1
inside Directory2
.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2")
This example moves Directory1
inside Directory2
, overwriting the directory if it already exists.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2",
True)
Remarks
If an attempt is made to move a directory inside a directory that does not exist, the target structure will be created.
See also
- MoveFile(String, String)
- CopyDirectory(String, String)
- UIOption
- Objects (Visual Basic)
- Creating, Deleting, and Moving Files and Directories in Visual Basic
Applies to
.NET Framework 4.8.1 og aðrar útgáfur
Vara | Útgáfur |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9 |
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
Moves a directory from one location to another.
public:
void MoveDirectory(System::String ^ sourceDirectoryName, System::String ^ destinationDirectoryName, bool overwrite);
public void MoveDirectory (string sourceDirectoryName, string destinationDirectoryName, bool overwrite);
member this.MoveDirectory : string * string * bool -> unit
Public Sub MoveDirectory (sourceDirectoryName As String, destinationDirectoryName As String, overwrite As Boolean)
Parameters
- sourceDirectoryName
- String
Path of the directory to be moved.
- destinationDirectoryName
- String
Path of the directory to which the source directory is being moved.
- overwrite
- Boolean
True
if existing directories should be overwritten; otherwise False
. Default is False
.
Exceptions
The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \.\).
sourceDirectoryName
or destinationDirectoryName
is Nothing
or an empty string.
The directory does not exist.
The target directory already exists and overwrite
is set to False
.
The path exceeds the system-defined maximum length.
The operation is cyclic.
A file or directory name in the path contains a colon (:) or is in an invalid format.
The user lacks necessary permissions to view the path.
The user does not have required permission.
Examples
This example moves Directory1
inside Directory2
.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2")
This example moves Directory1
inside Directory2
, overwriting the directory if it already exists.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2",
True)
Remarks
If an attempt is made to move a directory inside a directory that does not exist, the target structure will be created.
See also
- MoveFile(String, String)
- CopyDirectory(String, String)
- Objects (Visual Basic)
- Creating, Deleting, and Moving Files and Directories in Visual Basic
Applies to
.NET Framework 4.8.1 og aðrar útgáfur
Vara | Útgáfur |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9 |
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
- Source:
- FileSystemProxy.vb
Moves a directory from one location to another.
public:
void MoveDirectory(System::String ^ sourceDirectoryName, System::String ^ destinationDirectoryName, Microsoft::VisualBasic::FileIO::UIOption showUI, Microsoft::VisualBasic::FileIO::UICancelOption onUserCancel);
public void MoveDirectory (string sourceDirectoryName, string destinationDirectoryName, Microsoft.VisualBasic.FileIO.UIOption showUI, Microsoft.VisualBasic.FileIO.UICancelOption onUserCancel);
member this.MoveDirectory : string * string * Microsoft.VisualBasic.FileIO.UIOption * Microsoft.VisualBasic.FileIO.UICancelOption -> unit
Public Sub MoveDirectory (sourceDirectoryName As String, destinationDirectoryName As String, showUI As UIOption, onUserCancel As UICancelOption)
Parameters
- sourceDirectoryName
- String
Path of the directory to be moved.
- destinationDirectoryName
- String
Path of the directory to which the source directory is being moved.
- showUI
- UIOption
Specifies whether to visually track the operation's progress. Default is UIOption.OnlyErrorDialogs
.
- onUserCancel
- UICancelOption
Specifies whether or not an exception is thrown when the user cancels the operation. Default is UICancelOption.ThrowException
.
Exceptions
The path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \.\).
sourceDirectoryName
or destinationDirectoryName
is Nothing
or an empty string.
The directory does not exist.
onUserCancel
is set to ThrowException
and a subdirectory of the file cannot be copied.
onUserCancel
is set to ThrowException
, and the user cancels the operation, or the operation cannot be completed.
The user lacks necessary permissions to view the path.
The path exceeds the system-defined maximum length.
The operation is cyclic.
A file or directory name in the path contains a colon (:) or is in an invalid format.
The user does not have required permission.
Examples
This example moves Directory1
inside Directory2
.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2")
This example moves Directory1
inside Directory2
, overwriting the directory if it already exists.
My.Computer.FileSystem.MoveDirectory("C:\Directory1", "C:\Directory2",
True)
Remarks
If an attempt is made to move a directory inside a directory that does not exist, the target structure will be created.
See also
- MoveFile(String, String)
- CopyDirectory(String, String)
- UIOption
- UICancelOption
- Objects (Visual Basic)
- Creating, Deleting, and Moving Files and Directories in Visual Basic
Applies to
.NET Framework 4.8.1 og aðrar útgáfur
Vara | Útgáfur |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 5, 6, 7, 8, 9 |
.NET umsögn
.NET er opið verkefni. Veldu tengil til að gefa umsögn: