Generalising the code for adding rank strings
to filenames.