Use:
System.IO.File.GetAttributes(string path)
and check whether the returned FileAttributes
result contains the value FileAttributes.Directory
:
bool isDir = (File.GetAttributes(path) & FileAttributes.Directory)
== FileAttributes.Directory;
More Related Contents:
- Wait until file is unlocked in .NET
- Better way to check if a Path is a File or a Directory?
- How do I open an already opened file with a .net StreamReader?
- How to get files in a relative path in C#
- Get path to execution directory of Windows Forms application
- How do I get the directory from a file’s full path?
- Process.Start a file without Extension
- How to quickly check if folder is empty (.NET)?
- Delete files older than 3 months old in a directory using .NET
- How can I detect the type of a dll? (COM, .NET, WIN32)
- C# Searching for files and folders except in certain folders
- XPath and XSLT 2.0 for .NET? [closed]
- Using Json.NET converters to deserialize properties
- Strange issue with System.Net.Http 4.2.0.0 not found
- What is the difference between List (of T) and Collection(of T)?
- When and when-not to install into the GAC?
- Linq int to string
- Parser Error Message: Could not load type ‘TestMvcApplication.MvcApplication’
- WCF Service Returning “Method Not Allowed”
- Get HTTP requests and responses made using HttpWebRequest/HttpWebResponse to show in Fiddler
- Is SSE floating-point arithmetic reproducible?
- Connection string using Windows Authentication
- instance of entity type cannot be tracked because another instance with same key value is tracked [closed]
- How to continue field output on a second page?
- Why does IQueryable.All() return true on an empty collection?
- How to draw a signature and save it to disc as a Bitmap?
- Maximize another process’ Window in .NET
- Maximum Memory a .NET process can allocate
- .NET — Textbox control – wait till user is done typing
- How to serialize a large graph of .NET objects into a SQL Server BLOB without creating a large buffer?