Created
February 13, 2016 20:15
-
-
Save jeremybeavon/11da077d3e2054d7a9e6 to your computer and use it in GitHub Desktop.
C# Interactive function for renaming files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RenameFiles(string directory, string fileMatch, string replacement) | |
{ | |
foreach (string file in Directory.GetFiles(directory)) | |
{ | |
File.Move(file, Path.Combine(Path.GetDirectoryName(file), System.Text.RegularExpressions.Regex.Replace(Path.GetFileName(file), fileMatch, replacement))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment