def backup(self, target, skipDirs = False):
        target = self._normpath(target)
        try:
            sb = os.lstat(target)
        except __HOLE__:
            sb = None

        if sb:
            path = os.path.dirname(target)
            name = os.path.basename(target)

            tmpfd, tmpname = tempfile.mkstemp(name, '.ct', path)
            os.close(tmpfd)
            os.unlink(tmpname)
            if not stat.S_ISDIR(sb.st_mode):
                self._backup(target, tmpname, sb)
                os.link(target, tmpname)
            elif not skipDirs:
                self._backdir(target, sb)
dataset/ETHPy150Open sassoftware/conary/conary/local/journal.py/JobJournal.backup