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);
            }
        }
    }
}
相关推荐
淡海水2 小时前
02-07-原理篇-GC暂停时间的本质
开发语言·unity·c#·gc·暂停时间
WarPigs2 小时前
UI路径配置SO>字典json工作流
ui·unity
小羊没烦恼!4 小时前
OS X 上使用.NET开发应用程序
开发语言·前端·数据库·人工智能·c#·策略模式
Behavior5 小时前
Unity 7.0 Alpha 拆解:编辑器干掉 Mono 换 CoreCLR
c#·unity3d·游戏开发
淡海水6 小时前
02-06-原理篇-增量式GC与并发GC
算法·unity·c#·并发·gc·增量
Vertira6 小时前
C# 函数封装成 DLL,
开发语言·c#
浅尝辄止;8 小时前
设计模式在HIS/LIS医疗系统中的完整实践指南(C#版)
开发语言·设计模式·c#
kimloner18 小时前
开源一个 376KB 的 Windows 桌面小工具:便签 + 截图标注 + OCR + 待办提醒(C# / WinForms)
windows·开源·c#·ocr·winforms
阿松爱学习18 小时前
【Unity开发】Aspose.PDF的使用
unity·pdf·c#
半亩码田19 小时前
C#转Python第4.8篇:正则表达式:Python re 模块 vs C# System.Text.RegularExpressions
python·正则表达式·c#