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);
            }
        }
    }
}
相关推荐
淡海水1 小时前
【节点】[Blackbody节点]原理解析与实际应用
unity·游戏引擎·shadergraph·图形·blackbody
avi91113 小时前
Unity-海水效果+ShaderGraph-非专业不谈虚的效果-分享实用Editor源码
unity·游戏引擎
烛阴4 小时前
代码的“病历本”:深入解读C#常见异常
前端·c#
努力小周5 小时前
基于STM32的智能台灯系统设计与实现
stm32·单片机·嵌入式硬件·c#·毕业设计·毕设·javaee
arron88995 小时前
C# 项目源码进行全面的技术架构和调用逻辑分析。以下是系统性的技术方案
开发语言·架构·c#
一个帅气昵称啊6 小时前
.Net使用AgentFramework进行多Agent工作流编排-智能体AI开发
c#·.net·agentframework
czhc11400756636 小时前
Winform126 DataGrIdView ListView
c#·winform
猫不在7 小时前
MVC和MVVM
unity
老朱佩琪!7 小时前
在Unity中实现状态机设计模式
开发语言·unity·设计模式
csdn_aspnet7 小时前
C# .NETCore json字符串压缩为一行
c#·json·.netcore