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);
            }
        }
    }
}
相关推荐
xcLeigh11 小时前
Unity基础:GameObject与Component——Unity核心架构思想彻底理解
unity·教程·component·gameobject
EIP低代码平台11 小时前
EIP低代码平台-系统参数配置详解|落地三级等保+高灵活私有化部署方案
低代码·c#·权限·工作流·netcore
王莎莎-MinerU12 小时前
MCP 解决的是工具接入,科研 Agent 还缺的是科学证据接口标准化
开发语言·网络·人工智能·深度学习·pdf·c#·php
-银雾鸢尾-13 小时前
C#中Object类内的方法
开发语言·c#
tiankong121314 小时前
如何拓展多态下的子类
设计模式·c#
geats人山人海15 小时前
c# 第九章 record
开发语言·c#
郝学胜-神的一滴16 小时前
中级OpenGL教程 022:探秘三维世界的血脉传承——物体父子关系与矩阵递归奥义
c++·线性代数·unity·矩阵·游戏引擎·unreal engine·opengl
-银雾鸢尾-16 小时前
C#中的抽象类与抽象方法
开发语言·c#
影寂ldy17 小时前
C# Task 进阶:WaitAll / WaitAny / WhenAll / WhenAny
开发语言·c#