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);
            }
        }
    }
}
相关推荐
rockey6272 小时前
C#脚本引擎之AScript与Z.Expressions.Eval对比
c#·.net·script·expression·动态脚本
Madokaly5 小时前
DOTween的Vector3Plugin
unity
天下无敌笨笨熊5 小时前
C#Modbus串口开发心得
开发语言·c#
CSDN_RTKLIB5 小时前
const与readonly关键字
c#
leonkay6 小时前
C# 锁机制——【2】深入原理
开发语言·后端·spring·c#·个人开发
geovindu10 小时前
CSharp: Wordcloud
开发语言·后端·c#·.net·.netcore·词云
geovindu11 小时前
CSharp: Command Pattern
开发语言·后端·c#·.net·.netcore·命令模式·行为模式
格林威14 小时前
C# 相机图像阴影校正:使用OpenCvSharp实现工业相机阴影平场校正功能
人工智能·数码相机·opencv·计算机视觉·c#·机器视觉·工业相机
俊昭喜喜里14 小时前
c#中的构造函数
开发语言·数据库·c#
hahaha601615 小时前
HLS高层次综合设计--axi之burst纠偏
开发语言·算法·fpga开发·c#