renamer now cleaning the paths to remove special characters

This commit is contained in:
reven
2022-01-31 22:51:55 +13:00
parent 420274a24c
commit c731d02965

View File

@@ -52,7 +52,7 @@
newFile = newFile.Replace('\\', Path.DirectorySeparatorChar);
newFile = newFile.Replace('/', Path.DirectorySeparatorChar);
newFile = args.ReplaceVariables(newFile, stripMissing: true);
newFile = args.ReplaceVariables(newFile, stripMissing: true, cleanSpecialCharacters: true);
newFile = Regex.Replace(newFile, @"\.(\.[\w\d]+)$", "$1");
// remove empty [], (), {}
newFile = newFile.Replace("()", "").Replace("{}", "").Replace("[]", "");
@@ -62,7 +62,7 @@
newFile = Regex.Replace(newFile, @"\s(\.[\w\d]+)$", "$1");
newFile = newFile.Replace(" \\", "\\");
string destFolder = args.ReplaceVariables(DestinationPath ?? string.Empty, stripMissing: true);
string destFolder = args.ReplaceVariables(DestinationPath ?? string.Empty, stripMissing: true, cleanSpecialCharacters: true);
if (string.IsNullOrEmpty(destFolder))
destFolder = new FileInfo(args.WorkingFile).Directory?.FullName ?? "";