Attributes
GetAttributes
Returns the attributes of a file
This returns a FileAttributes enumeration that identifies the file's attributes.
FileAttributes has a FlagsAttribute that allows bitwise combination of its members so that a file can have multiple sttributes.
System.IO.File.GetAttributes(file)
If you want to determine if a file has a particular attribute you have to test for that using the boolean AND operator.
System.IO.File.FileAttributes oFileAttributes;
oFileAttributes = System.IO.File.GetAttributes("file1.txt");
if (oFileAttributes && System.IO.File.FileAttributes.ReadOnly) <> 0)
{
}
SetAttributes
Sets the attributes for a file
System.IO.File.SetAttributes(file, attributes)
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext