public static void Rename(List <FileInfo> listOfSelectedFiles, int roundRobinValue, Dictionary <string, bool> dynamicsCheckBoxStates, Note _selectedStartingNote, Note _selectedEndingNote, string _fileName, string fileFormat, Dictionary <string, bool> dynamicsStates) { int fileCount = 0; if (_fileName.Contains(".")) { _fileName = FileNaming.removeFormat(_fileName); } List <Note> notesBetween = NoteGenerator.createNotes(_selectedStartingNote, _selectedEndingNote); List <string> namingOrder = FileNaming.namingOrder(notesBetween, roundRobinValue, dynamicsCheckBoxStates); string folderPath = listOfSelectedFiles[0].DirectoryName; foreach (FileInfo file in listOfSelectedFiles) { if (fileCount + 1 > namingOrder.Count) { break; } string newFileName = _fileName + $"({fileCount}) " + namingOrder[fileCount] + fileFormat; string temppath = Path.Combine(folderPath, newFileName); file.MoveTo(temppath); fileCount++; } }