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);
            }
        }
    }
}
相关推荐
工程师0074 小时前
C# 装箱、拆箱 底层原理
c#·装箱和拆箱
清风明月一壶酒5 小时前
OpenClaw自动处理Word文档全流程
开发语言·c#·word
工程师0078 小时前
C# 值类型 / 引用类型 内存布局(栈、堆、托管堆)
c#·值类型与引用类型
chao18984410 小时前
完整MES系统实现 (C# 客户端服务器)
服务器·windows·c#
月昤昽11 小时前
autocad二次开发 2.旋转
c#·autocad·autocad二次开发
rockey62711 小时前
基于AScript的python3脚本语言发布啦!
python·c#·.net·script·python3·eval·expression·function·动态脚本
工程师00711 小时前
C# 字符串不可变性 + 字符串驻留池原理
c#·字符串拘留池
RPGMZ13 小时前
RPGMakerMZ 地图存档点制作 标题继续游戏直接读取存档
开发语言·javascript·游戏·游戏引擎·rpgmz·rpgmakermz
唐青枫17 小时前
内存为什么越来越高?C#.NET GC 详解:分代回收、LOH、终结器与性能优化实战
c#·.net
郝学胜-神的一滴17 小时前
[简化版 GAMES 101] 计算机图形学 07:图形学投影完全推导
c++·unity·图形渲染·three.js·unreal engine