EDITOR HOW TO GET A TEXT FILE OBJECT OR INSTANCE ID TO FOCUS THE PROJECT WINDOW ON IT

I WANT TO FOCUS THE PROJECT WINDOW ON A “txt” FILE BUT I CAN’T GET AN INSTANCE ID OR AN OBJECT OF IT TO MAKE THE PING FUNCTION WORK

Here is a code template of what i wanna do:

using UnityEngine;
using UnityEditor;
using System.IO;
using System;
using System.Reflection;
using System.Collections.Generic;

//That's what im using for the rest of the script

///

File.WriteAllText("Assets/Test.txt", "text file");

DirectoryInfo dir = new DirectoryInfo("Assets");
FileInfo[] files = dir.GetFiles();

FileInfo file = null;

foreach (var item in files)
{
	if (item.name.Contains("Test"))
        {
                file = item;
        }
}

//The file i want doesn't have an Instance ID or an Object reference to ping it in the editor
EditorGUIUtility.PingObject(file);

Once you’ve saved your file you need to get the unity object associated with it from the AssetDatabase.

You can load your .txt file as a TextAsset type and then call ping on that object.