/*
http://aang-notes.blogspot.com/
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace rename_file_masal {
class Program {
static void Main(string[] args) {
string pathFolder = @"path folder";
string namaBaru = "";
foreach (string filenya in Directory.GetFiles(pathFolder)) {
namaBaru = Path.GetFileName(filenya).Replace("teks", "");
try {
File.Move(filenya, pathFolder + namaBaru);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("File " + filenya + " Berhasil direname!");
} catch (Exception errr) {
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("File " + filenya + " gagal direname! (" + errr.Message + ")");
}
}
Console.WriteLine("Operasi telah selesai!");
Console.ReadKey();
}
}
}