File.GetAttributes Method (String)
Gets the FileAttributes of the file on the path.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- path
-
Type:
System.String
The path to the file.
| Exception | Condition |
|---|---|
| ArgumentException | path is empty, contains only white spaces, or contains invalid characters. |
| PathTooLongException | The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. |
| NotSupportedException | path is in an invalid format. |
| FileNotFoundException | path represents a file and is invalid, such as being on an unmapped drive, or the file cannot be found. |
| DirectoryNotFoundException | path represents a directory and is invalid, such as being on an unmapped drive, or the directory cannot be found. |
| IOException | This file is being used by another process. |
| UnauthorizedAccessException | The caller does not have the required permission. |
The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.
For a list of common I/O tasks, see Common I-O Tasks.
for reading files. Associated enumeration: FileIOPermissionAccess.Read
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 4.0