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);
            }
        }
    }
}
相关推荐
警醒与鞭策8 小时前
【无标题】
android·unity·性能优化·游戏引擎·perforce
zhchyun20089 小时前
【Unity UI 进阶】仿 Element UI 打造企业级 Unity UI 组件库(10)
ui·unity·游戏引擎
波力海苔夹心脆6759 小时前
C# 序列化与反序列化详解:System.Text.Json、Newtonsoft.Json、XmlSerializer 用法、特性选项与安全实践
经验分享·后端·c#·json·.net
地狱为王14 小时前
Unity使用NVIDIA的Audio2Face驱动口型
unity·游戏引擎
小羊没烦恼!15 小时前
在Scrum中实施敏捷建模
java·开发语言·windows·算法·c#
Lost of 程序猿16 小时前
建造者模式实战:告别“十参数构造函数“的数据导出任务
后端·设计模式·c#·asp.net
ebiobiz16 小时前
STM32F4 Unity 单元测试与多次测试失败率统计详细步骤
stm32·unity·单元测试
mudtools17 小时前
在.NET现有系统中快速集成飞书任务分配能力
后端·c#·.net
工具派20 小时前
Word文档太大怎么拆分?段落结构与两种拆法的边界实测
开发语言·c#·word
潜龙952721 小时前
需求文档一键变测试用例:手工用例智能生成平台
开发语言·c#