Пример #1
0
    def create_backup(self, files, instance):
        backup_filename = _log_file_name(instance, "backup.zip")
        ensure_dir(backup_filename)

        backup = ZipFile(backup_filename, "w")
        for filename in files:
            backup.write(filename)
        backup.close()
        instance.backup_file.name = backup_filename
Пример #2
0
    def create_backup(self, files, instance):
        backup_filename = _log_file_name(instance,
                "backup.zip")
        ensure_dir(backup_filename)

        backup = ZipFile(backup_filename,"w")
        for filename in files:
            backup.write(filename)
        backup.close()
        instance.backup_file.name = backup_filename
Пример #3
0
    def delete_obsolete_files(self, files, instance):
        """ Delete all the obsolete files and save
            their name in a log file.
        """
        log_filename = _log_file_name(instance, "deleted_files.log")
        ensure_dir(log_filename)

        log = open(log_filename, "w")
        for filename in files:
            log_string = "removing: %s" % filename
            print(log_string)
            log.write(log_string + "\n")
            os.remove(file)
        log.close()
        instance.log_file.name = log_filename
Пример #4
0
    def delete_obsolete_files(self, files, instance):
        """ Delete all the obsolete files and save
            their name in a log file.
        """
        log_filename = _log_file_name(instance,
                "deleted_files.log")
        ensure_dir(log_filename)

        log = open(log_filename, "w")
        for filename in files:
            log_string = "removing: %s" % filename
            print(log_string)
            log.write(log_string + "\n")
            os.remove(filename)
        log.close()
        instance.log_file.name = log_filename