addSuffix

emlib.filetools.addSuffix(filename, suffix)[source]

Add a suffix between the name and the extension

Parameters:
  • filename (str) – the filename to add a suffix to

  • suffix (str) – the suffix to add

Return type:

str

Returns:

the modified filename

Example

>>> name = "test.txt"
>>> newname = addSuffix(name, "-OLD")
>>> newname
test-OLD.txt
>>> os.rename(name, newname)

This does NOT rename the file, it merely returns the string