unity C#设置文件为不可见

unity C#设置文件为不可见

csharp 复制代码
///
///设置文件为隐藏//
///
using UnityEngine;
using System.IO;

public class SetFolderInvisible : MonoBehaviour
{
    private void Start()
    {
        string folderPath = "Qi/Video";

        // 将文件夹属性设置为隐藏和系统
        SetFolderAttributes(folderPath, FileAttributes.Hidden | FileAttributes.System);
    }

    private void SetFolderAttributes(string folderPath, FileAttributes attributes)
    {
        if (Directory.Exists(folderPath))
        {
            // 获取文件夹下的所有文件和子文件夹
            string[] files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);

            // 将文件夹的属性设置为隐藏和系统
            foreach (var file in files)
            {
                File.SetAttributes(file, attributes);
            }
        }
    }
}
相关推荐
code bean9 小时前
【C#】 `Channel<T>` 深度解析:生产者-消费者模式的现代解法
数据结构·c#
吴可可12313 小时前
C# CAD二次开发:合并首尾重合多段线
c#
凯尔31513 小时前
Unity简单涂料实现
unity·游戏引擎·图形渲染
EIP低代码平台14 小时前
EIP低代码平台 - 应用管理 - 表单设计
低代码·c#·权限·工作流·netcore
czhc114007566314 小时前
726:zoffset
c#
刘步权16 小时前
KY-RTI分布仿真技术:第十三章 基于Unity的多语言三维态势仿真——以 Island Assault(夺岛突击)想定为例
unity·游戏引擎·仿真·态势·ky-rti·hla·rti
向夏威夷 梦断明暄17 小时前
C# 弃元模式:从语法糖到性能利器的深度解析
服务器·数据库·c#
rick97718 小时前
C# × Python 互操不再难:DotNetPy 让两大生态真正融合
c#
ellis197019 小时前
C#/Unity清理非托管资源
unity·c#
吴可可1231 天前
C#用OpenCVSharp提取轮廓生成CAD多段线
c#