FileSystem.DirectoryExists(String) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定したディレクトリが存在する場合は、 True を返します。
public:
static bool DirectoryExists(System::String ^ directory);
public static bool DirectoryExists(string directory);
static member DirectoryExists : string -> bool
Public Shared Function DirectoryExists (directory As String) As Boolean
パラメーター
- directory
- String
ディレクトリのパス。
返品
True ディレクトリが存在する場合。それ以外の場合は False。 このメソッドは、パラメーターがディレクトリではなくファイルの名前とパスを表す場合も、 False を返します。
例
この例では、ディレクトリ C:\backup\logs が存在するかどうかを判断し、そのプロパティを確認します。
If My.Computer.FileSystem.DirectoryExists("C:\backup\logs") Then
Dim logInfo = My.Computer.FileSystem.GetDirectoryInfo(
"C:\backup\logs")
End If