FileInfo FInfo = new FileInfo(FilePath);
if (IsHidden == true)
{
FInfo.Attributes = FileAttributes.Hidden;
}
if (IsSystem == true)
{
FInfo.Attributes = FileAttributes.System;
}
if (IsArchive == true)
{
FInfo.Attributes = FileAttributes.Archive;
}
if (IsReadOnly == true)
{
FInfo.Attributes = FileAttributes.ReadOnly;
}
四个属性都设为true
为什么只修改文件的只读属性?