pwtools.common.backup

pwtools.common.backup(src, prefix='.')[source]

Backup (copy) src to <src><prefix><num>, where <num> is an integer starting at 0 which is incremented until there is no destination with that name.

Symlinks are handled by shutil.copy() for files and shutil.copytree() for dirs. In both cases, the content of the file/dir pointed to by the link is copied.

Parameters:
  • src (str) – name of file/dir to be copied

  • prefix (str, optional) –