Repository: godotengine/godot (language: cpp)

Issue:
Duplicating a folder messes up script UIDs
### Tested versions

 v4.4.dev7.official [46c8f8c5c]

### System information

Windows 11

### Issue description

Duplicating a folder duplicates script UID's and its almost impossible to fix because even if i delete the UID file, remove the UID in the tscn file, reload the editor etc. it somehow finds a way to still keep attaching the wrong script (the one its copied from). I duplicate folders all the time to make new enemies and this version is just completely unusable because of this

### Steps to reproduce

duplicate a folder with a script

### Minimal reproduction project (MRP)

just duplicate a folder


Discussion / hints:
By "duplicating" do you mean duplicating *in* the editor or *out* of the editor? If it is out of the editor this is already solved in:
* https://github.com/godotengine/godot/pull/100927
> By "duplicating" do you mean duplicating _in_ the editor or _out_ of the editor? If it is out of the editor this is already solved in:
> 
> * [Assign new UID when duplicating file externally #100927](https://github.com/godotengine/godot/pull/100927)

in the latest dev snapshot either editor or file explorer but if its solved in editor for next snapshot that's great 👍
Then that's solved in that PR, closing, if it persists in the next snapshot please comment here again
This still happens in the new beta snapshot (v4.4.beta1.official [d33da79d3])

Fix patch:
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index e5e27a11c613..e5cacf92e606 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -3012,7 +3012,7 @@ bool EditorFileSystem::_copy_directory(const String &p_from, const String &p_to,
 	for (String F = old_dir->_get_next(); !F.is_empty(); F = old_dir->_get_next()) {
 		if (old_dir->current_is_dir()) {
 			success = _copy_directory(p_from.path_join(F), p_to.path_join(F), p_files) && success;
-		} else if (F.get_extension() != "import") {
+		} else if (F.get_extension() != "import" && F.get_extension() != "uid") {
 			CopiedFile copy;
 			copy.from = p_from.path_join(F);
 			copy.to = p_to.path_join(F);


Test patch: