C# rename files
static void RenameFiles() { string sourceDir = @"D:\ll"; string[] allFiles = Directory.GetFiles(sourceDir, "*.mp3", SearchOption.AllDirectories); if(allFiles!=null && allFiles.Any()) { for(int i = 0; i < allFiles.Count(); i++) { string newName =Path.Combine(sourceDir, i + ".mp3"); File.Move(allFiles[i], newName); } } }