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);
            }
        }
    }
}
相关推荐
m0_7482480218 小时前
C++与C#布尔类型深度解析:从语言设计到跨平台互操作
c++·stm32·c#
HahaGiver66619 小时前
从0到1做一个“字母拼词”Unity小游戏(含源码/GIF)- 字母拼词正确错误判断
unity·游戏引擎·游戏程序
LeonDL16819 小时前
【通用视觉框架】基于C#+VisionPro开发的视觉框架软件,全套源码,开箱即用
人工智能·c#·visionpro·通用视觉框架·机器视觉框架·视觉框架软件·机器视觉软件
一抓掉一大把20 小时前
RuoYi .net-实现商城秒杀下单(redis,rabbitmq)
redis·mysql·c#·rabbitmq·.net
睡前要喝豆奶粉20 小时前
在.NET Core Web Api中使用阿里云OSS
阿里云·c#·.netcore
缺点内向1 天前
C#: 高效移动与删除Excel工作表
开发语言·c#·.net·excel
yue0081 天前
C# 分部类读取学生信息
开发语言·c#
聪明努力的积极向上1 天前
【C#】事件简单解析
开发语言·c#
qq_12498707531 天前
基于C#的贵州省黔北地区乡村避暑生活共享平台设计与实现(源码+论文+部署+安装)
c#·毕业设计·asp.net·生活
LateFrames1 天前
C# 中,0.1 在什么情况下不等于 0.1 ?
开发语言·c#