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);
            }
        }
    }
}
相关推荐
贪玩的蛋挞19 分钟前
C#与闭包
开发语言·c#
忧郁的紫菜5 小时前
基础实现:单篇 Markdown 转 Word
开发语言·c#·word
甜美的小天鹅5 小时前
Swifter C#之inline还是不inline,这是个问题
开发语言·c#
翼帆10 小时前
.NET 程序保护实战系列01-流水线架构与保护引擎总览
c#·破解
落寞的电源11 小时前
Delegate = Object + MethodInfo
开发语言·数据库·c#
Denuin多啦咧梦12 小时前
玩转 .NET 依赖注入:Microsoft.Extensions.DependencyInjection 深度指南
c#·.net·依赖注入
Ricky_Theseus13 小时前
Trie 字典树:前缀匹配利器
开发语言·c#
郝学胜-神的一滴13 小时前
[简化版 GAMES 101] 计算机图形学 16:纹理走样、Mipmap、三线性插值、各向异性过滤原理全解
unity·游戏引擎·godot·图形渲染·three.js·opengl·unreal
北域码匠1 天前
嵌入式限幅滤波:工业信号降噪利器
c#·传感器采集·数据预处理·嵌入式算法·限幅滤波·数字滤波·数据降噪
2301_767113981 天前
Superpowers 游戏引擎从零开发实战指南
游戏引擎