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);
            }
        }
    }
}
相关推荐
心前阳光3 分钟前
Unity使用豆包语言模型
unity·语言模型
魔士于安3 分钟前
unity宇宙飞船
游戏·unity·游戏引擎·贴图·模型
量子物理学4 分钟前
WPF 标签预览可以显示图片运行后不显示
c#·wpf
RReality32 分钟前
【Unity Shader】高级光照与阴影总结:渲染路径、多光源、透明阴影
unity·游戏引擎
浪客川40 分钟前
godot-rust入门案例
rust·游戏引擎·godot
RPGMZ1 小时前
RPGMakerMZ游戏引擎 地图角色顶部显示称号
javascript·游戏引擎·rpgmz·rpgmakermz
chushiyunen1 小时前
BM25稀疏检索算法笔记
笔记·算法·c#
玩泥巴的10 小时前
存储那么贵,何不白嫖飞书云文件空间
c#·.net·二次开发·飞书
harrain18 小时前
拟合模型与虚幻引擎
游戏引擎·数字孪生·虚幻
脑电信号要分类20 小时前
将多张图片拼接成一个pdf文件输出
pdf·c#·apache