mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-06-20 18:58:16 +08:00
build: 📦 整理构建相关的工程文件 (#64)
This commit is contained in:
27
scripts/rename.csx
Normal file
27
scripts/rename.csx
Normal file
@ -0,0 +1,27 @@
|
||||
#r "nuget: NSExt, 1.1.0"
|
||||
using NSExt.Extensions;
|
||||
|
||||
Console.WriteLine("请输入原始名称(NetAdmin):");
|
||||
var oldName = Console.ReadLine().NullOrEmpty("NetAdmin");
|
||||
Console.WriteLine("请输入替换名称:");
|
||||
var newName = Console.ReadLine();
|
||||
foreach (var path in Directory.EnumerateDirectories("../", $"*{oldName}*",
|
||||
SearchOption.AllDirectories))
|
||||
{
|
||||
Console.Write($"{path} --> ");
|
||||
var newPath = path.Replace(oldName, newName);
|
||||
Directory.Move(path, newPath);
|
||||
Console.WriteLine(newPath);
|
||||
}
|
||||
|
||||
|
||||
Console.WriteLine();
|
||||
foreach (var path in Directory.EnumerateFiles("../", $"*.*", SearchOption.AllDirectories))
|
||||
{
|
||||
File.WriteAllText(path, File.ReadAllText(path).Replace(oldName, newName));
|
||||
var newPath = path.Replace(oldName, newName);
|
||||
if (newPath == path) continue;
|
||||
Console.Write($"{path} --> ");
|
||||
Directory.Move(path, newPath);
|
||||
Console.WriteLine(newPath);
|
||||
}
|
Reference in New Issue
Block a user