My folder is unusable after using AssetDataBase.CreateAsset !

Hi !
I was experimenting with AssetDataBase.CreateAsset, and I put a Path that did not have a new name in the end, only had the path to a folder, like this for example : “Asset/FolderName”. However after I ran the script, it changed the folder itself (I thought it would create the asset at the specified path), and now, Unity can’t open the folder anymore and shows this error :
Unable to open Assets/_Common/Environmental/GrassShader/_GrassUpgrade: Check external application preferences.
I also can’t open the folder in Windows because it became a File with no extension.
I can’t show you the script I used since my script was inside the folder ! I remember using only this :
AssetDatabase.CreateAsset(MeshToSave, FilePath);
AssetDatabase.SaveAsset();

Is there any way to recover my files ? If not then am I understanding that basically you could delete your entire Asset folder if you were to mess up one string ? Seems kinda dangerous to me ! Is there any alternative for creating a file ?

Thanks in advance for any help you can give !

Yeah looks like you wrote the mesh to the folder. It’s not actually an invalid thing to do, and this behaviour is clearly shown in the documentation for AssetDatabase.CreateAsset(). The path includes the directory, file name, and the file extension in the one string, so be sure make that distinction when writing this functionality.

I did some googling but doesn’t look like there’s much of a way to return a file into a folder. So unless you are using version control software… lesson learnt.

Thanks for your answer ! I had only one small script in the folder so it’s not a big deal but I guess now I’ll remember not to make the same mistake again.