You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;
namespace Apewer.Run{
class FileRenamer {
public FileRenamer() { // RenameZQSV();
var paths = StorageUtility.GetSubFiles(@"Y:\telecast\芸汐传", true); foreach (var path in paths) { var name = Path.GetFileName(path);
// name = name.Replace(" ", "");
name = name.Replace(".qsv.flv.mp4", ".mp4"); name = name.Replace(".qsv.flv.mp4", ""); name = name.Replace("【4K】", "");
var split = name.Split(' '); split[1] = split[1].Replace("第", "").Replace("集", ""); if (split[1].Length == 1) split[1] = "0" + split[1]; split[1] = "第 " + split[1] + " 集";
name = string.Join(" - ", split) + ".mp4";
var newPath = Path.Combine(Path.GetDirectoryName(path), name); if (newPath != path) { File.Move(path, newPath); Console.WriteLine($"{path} -> {newPath}"); } // else Console.WriteLine(path);
} }
void RenameZQSV() { var paths = Apewer.StorageUtility.GetSubFiles("z:\\", true); foreach (var path in paths) { RenameFile(path, " ", "_"); RenameFile(path, "【蓝光1080P】", ""); } }
void RenameFile(string path, string oldSub, string newSub) { if (path.Contains(oldSub)) { var newName = path.Replace(oldSub, newSub); File.Move(path, newName); Console.WriteLine($"{path} -> {newName}"); } else { Console.WriteLine(path); } }
}
}
|