using UnityEngine; using System.IO; public class FileRenamer : MonoBehaviour { // Set the folder path where your .cas files are located string folderPath = "C:/Users/mbiha/Downloads/Final Game-Play Animations/Cat - Game/CatFootwork - Finalised"; void Start() { RenameFiles(); } void RenameFiles() { // Get all .cas files in the folder string[] files = Directory.GetFiles(folderPath, "*.casc"); foreach (string filePath in files) { // Extract the filename without extension string fileName = Path.GetFileNameWithoutExtension(filePath); print(fileName); // Split the filename by '-' string[] parts = fileName.Split('-'); // Extract the animation name from the second part string[] nameParts = parts[0].Split('.'); string animationName = nameParts[1]; // Construct the new file name string newFileName = animationName + ".casc"; // Construct the new file path string newFilePath = Path.Combine(folderPath, newFileName); // Rename the file File.Move(filePath, newFilePath); Debug.Log("File renamed from " + filePath + " to " + newFilePath); } } }