GetAttributes(Path: String): FileAttributes;
Path - a path to a directory attributes of which should be got.
The GetAttributes method returns attributes of a directory passed by parameter Path.
The result of method execution is a combination of values of enumerable type FileAttributes. A logical operation can be used to check attributes And.
Sub UserProc(sPath: String);
Var
Attributes: Integer;
Begin
If Directory.Exists(sPath) Then
Attributes := Directory.GetAttributes(sPath);
Debug.WriteLine(Attributes);
If (Attributes And FileAttributes.ReadOnly) <> 0 Then
Debug.WriteLine("Attribute Read Only is set for directory" );
Else
Debug.WriteLine("Attribute Read Only is not set for directory" );
End If;
If (Attributes And FileAttributes.Hidden) <> 0 Then
Debug.WriteLine("Attribute Hidden is set for directory" );
Else
Debug.WriteLine("Attribute Hidden is not set for directory" );
End If;
End If;
End Sub UserProc;
While executing this example it is checked whether directory, specified in the parameter sPath, is present in file system. If a directory exists, values of its attributes are got. Information about state of attributes Read Only and Hidden is displayed in development environment console.
See also: