Last active
February 23, 2018 10:18
-
-
Save longtth/f9250884bf8654a24cb5249582f525a5 to your computer and use it in GitHub Desktop.
C# Check path is a file or dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileDirChecker | |
{ | |
public bool isDirectory(string path) | |
{ | |
bool ret = false; | |
// get the file attributes for file or directory | |
FileAttributes attr = File.GetAttributes(path); | |
if (attr.HasFlag(FileAttributes.Directory)) | |
ret = true; | |
else | |
ret = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment