[C#] How to Check if a directory Exists

Byantonhyip

Mar 12, 2019 #check if directory exist ftp c#, #how to check directory exists in ftp server using c#, #how to check file exists in directory c#, #how to check folder path exists in c#, #how to check ftp directory exists in c#, #how to check if a directory exist in c#, #how to check if a directory exists c#, #how to check if a directory exists in c#, #how to check if a directory path exists in c#, #how to check if a file directory exists in c#, #how to check if a file exists in a folder c#, #how to check if a file path exists c#, #how to check if a file path exists in c#, #how to check if a folder exist in c#, #how to check if a folder exists c#, #how to check if a folder exists in a directory in c#, #how to check if a folder exists in c#, #how to check if a path exists c#, #how to check if a path exists in c#, #how to check if any file exists in a directory in c#, #how to check if directory exists in ftp c#, #how to check if file exist in directory c#, #how to check if file exist in folder c#, #how to check if file exists in a folder c#, #how to check if file exists in directory using c#, #how to check if folder path exists in c#, #how to check if path exist c#, #how to check if path exist in c#, #how to check if the directory exists in c#, #how to check if the folder exists in c#, #how to check if user exists in active directory c#, #how to check the directory exists in c#, #how to check the folder exists in c#, #how to check whether a folder exists or not in c#
Chia sẻ

The following code snippet checks if a directory has subdirectories and files and delete them before deleting a directory.

Nội dung

Check if a directory Exists

The Directory.Exists method checks if the specified directory exists. The following code snippet checks if a directory exists or not and deletes only if the directory exists.

string root = @"C:Temp";
// If directory does not exist, don't even try
if (Directory.Exists(root))
{
    Directory.Delete(root);
}

 

ĐĂNG KÝ MUA HÀNG

    Email (*)

    Điện thoại (*)

    Tên sản phẩm/Dịch vụ:


    Chia sẻ
    Xem thêm  [C#] How to Get and Set Current Directory in C#

    Trả lời

    Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *