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);
            }
        }
    }
}
相关推荐
萌萌的提莫队长30 分钟前
Unity相机捕捉,图像识别,抠像+合成
opencv·unity
根号五2 小时前
JetBrains Rider 使用教程(1)新建解决方案
c#·jetbrains rider
海天鹰3 小时前
C#:接收从打开方式打开的参数
c#
宝桥南山3 小时前
.NET 11 - 尝试一下Minimal API中的异步验证新特性
microsoft·微软·c#·asp.net·.net·.netcore
开开心心_Every4 小时前
文件查重软件批量删除重复文件释放空间
java·开发语言·c#·计算机外设·ocr·excel·perl
波力海苔夹心脆6754 小时前
VisionPro 与 VisionMaster 对比(上):软件定位、开发环境与核心视觉工具对照
图像处理·算法·计算机视觉·c#·视觉检测·个人开发·vp9
疯狂戴夫冒险5 小时前
歇一会 · 久坐休息提醒工具(番茄钟)工具分享
c#
...6226 小时前
VisionMaster 测量模块工具
c#·visionmaster
mxwin19 小时前
Unity Shader 光线追踪原理与实战案例
unity·游戏引擎
samble1 天前
从零搭建灌装监控系统(十九):单元测试实战,xUnit + 内存SQLite + 反射测试私有方法
c#·wpf·mvvm·modbus·工业控制