chunk 1: core gameplay scripts scenes runtime assets
This commit is contained in:
43
Assets/Scripts/Utilities/FileRenamer.cs
Normal file
43
Assets/Scripts/Utilities/FileRenamer.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user