msmbuilder.io.backup

msmbuilder.io.backup(fn)

If fn exists, rename it and issue a warning

This function will rename an existing filename {fn}.bak.{i} where i is the smallest integer that gives a filename that doesn’t exist. This naively uses a while loop to find such a filename, so there shouldn’t be too many existing backups or performance will degrade.

Parameters:
fn : str

The filename to check.