selective-backup.py
This commit is contained in:
@@ -3,15 +3,20 @@ from zipfile import ZipFile
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
# base directory
|
||||||
|
basedir = "/media/hd/cloud"
|
||||||
|
|
||||||
|
# list of the paths to the files and directories to be copied, relative to the base directory
|
||||||
filelist = "/media/hd/cloud/Tilman/Computer/selective-backups/filelist.txt"
|
filelist = "/media/hd/cloud/Tilman/Computer/selective-backups/filelist.txt"
|
||||||
|
|
||||||
|
# duration for backups to be kept
|
||||||
days_to_keep = 5
|
days_to_keep = 5
|
||||||
months_to_keep = 5
|
months_to_keep = 5
|
||||||
|
|
||||||
|
# directories to backup to
|
||||||
daily_dir = "/media/hd/cloud/Tilman/Computer/selective-backups/daily/"
|
daily_dir = "/media/hd/cloud/Tilman/Computer/selective-backups/daily/"
|
||||||
monthly_dir = "/media/hd/cloud/Tilman/Computer/selective-backups/monthly/"
|
monthly_dir = "/media/hd/cloud/Tilman/Computer/selective-backups/monthly/"
|
||||||
|
|
||||||
basedir = "/media/hd/cloud"
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
today = datetime.today()
|
today = datetime.today()
|
||||||
target_filename = today.strftime('%Y-%m-%d') + "_selective-backup.zip"
|
target_filename = today.strftime('%Y-%m-%d') + "_selective-backup.zip"
|
||||||
@@ -19,8 +24,6 @@ target_filename = today.strftime('%Y-%m-%d') + "_selective-backup.zip"
|
|||||||
with open(filelist) as file:
|
with open(filelist) as file:
|
||||||
lines = [line.rstrip() for line in file]
|
lines = [line.rstrip() for line in file]
|
||||||
|
|
||||||
#os.chdir(basedir)
|
|
||||||
|
|
||||||
# backup directories and files
|
# backup directories and files
|
||||||
with ZipFile(daily_dir + target_filename, 'w') as zip:
|
with ZipFile(daily_dir + target_filename, 'w') as zip:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
|||||||
Reference in New Issue
Block a user