4.15. foundations.rotatingBackup

rotatingbackup.py

Platform:
Windows, Linux, Mac Os X.
Description:
This module defines the RotatingBackup class.
Others:
Code extracted from rotatingbackup.py written by leo.ss.pku@gmail.com

4.15.1. Module Attributes

foundations.rotatingBackup.LOGGER

4.15.2. Classes

class foundations.rotatingBackup.RotatingBackup(source=None, destination=None, count=3)[source]

Bases: object

This class provides a rotating backup system.

Warning

Backups destination folder should not be the same than the folder containing the source to be backuped!

Usage:

>>> file = "File.txt"
>>> destination = "backup"
>>> backup = RotatingBackup(file, destination)
>>> backup.backup()
True
>>> for i in range(3):
...     backup.backup()
...
True
True
True
>>> import os
>>> os.listdir(destination)
['File.txt', 'File.txt.1', 'File.txt.2', 'File.txt.3']
Parameters:
  • source – Backup source. ( String )
  • destination – Backup destination. ( String )
  • count – Backups count. ( Integer )
source[source]

This method is the property for self.__source attribute.

Returns:self.__source. ( String )
destination[source]

This method is the property for self.__destination attribute.

Returns:self.__destination. ( String )
count[source]

This method is the property for self.__count attribute.

Returns:self.__count. ( Integer )
backup()[source]

This method does the rotating backup.

Returns:Method success. ( Boolean )

Table Of Contents

Previous topic

4.14. foundations.pkzip

Next topic

4.16. foundations.strings

This Page