withFileNames takes a maybe list of existing rename-pairs, a list of
filenames and an action, and returns the resulting triple of affected files,
updated filename list and new rename details. If the rename-pairs are not
present, a new list is generated from the filesnames.