private static void batchRenameExtension(string Folder) { if (!Directory.Exists(Folder)) { return; } foreach (string f in Directory.GetFiles(Folder, "*", SearchOption.AllDirectories)) { try { string ext = Path.GetExtension(f); string newExt = FileFormat.Guess(f); if (ext != newExt) { File.Move(f, Path.Combine(Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f)) + newExt); } } catch { } } }