123456789101112131415161718192021222324252627282930313233 |
- using UnityEditor;
- using UnityEngine;
- namespace CustomGame.Scripts.Editor
- {
- public class FilesCopy : EditorWindow
- {
- private string _fromPath;
- private string _toPath;
- private string _extension = ".cs";
-
- [MenuItem("Tools/Helper/Copy Files")]
- private static void ShowWindow()
- {
- var window = GetWindow<FilesCopy>();
- window.titleContent = new GUIContent("Copy Files");
- window.Show();
- }
- private void OnGUI()
- {
- _fromPath = EditorGUILayout.TextField("From Path", _fromPath);
- _toPath = EditorGUILayout.TextField("To Path", _toPath);
- _extension = EditorGUILayout.TextField("Extension", _extension);
- if (!GUILayout.Button("Copy")) return;
- var files = System.IO.Directory.GetFiles(_fromPath, $"*.{_extension}", System.IO.SearchOption.AllDirectories);
- foreach (var file in files)
- {
- System.IO.File.Copy(file, _toPath + "/" + System.IO.Path.GetFileName(file));
- }
- }
- }
- }
|