返回顶部

收藏

设置目录下所有文件属性为可写

更多

设置目录下所有文件属性为可写

设置目录下所有文件属性为可写

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
Queue<FileSystemInfo> filefolders = new Queue<FileSystemInfo>(new DirectoryInfo(@"C:\cdrom").GetFileSystemInfos());
while (filefolders.Count>0)
{
    FileSystemInfo atom = filefolders.Dequeue();
    FileInfo file = atom as FileInfo;
    if (file == null)
    {
        DirectoryInfo directory = atom as DirectoryInfo;
        foreach (FileSystemInfo fi in directory.GetFileSystemInfos())
            filefolders.Enqueue(fi);
    }
    else
        file.Attributes&= ~FileAttributes.ReadOnly;
}

标签:c#

收藏

0人收藏

支持

0

反对

0

发表评论