You can't remove an item from a collection while iterating over it.
You can find the index of the item that needs to be removed and remove it after iteration has finished.
int indexToRemove = 0;
// Iteration start
if (fileName.Equals(names[i].Trim()))
{
indexToRemove = i;
break;
}
// End of iteration
attachmentsFilePath.RemoveAt(indexToRemove);
If, however, you need to remove more than one item, iterate over a copy of the list:
foreach(string fullFilePath in new List<string>(attachmentsFilePath))
{
// check and remove from _original_ list
}