From: Eduardo Robles Elvira Date: Fri, 18 Oct 2013 10:08:04 +0000 (+0200) Subject: adding support for filtering via whitelist with -inc X-Git-Tag: v2.2~82 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=4cbed687cf4296eb655c03a10d7311f2a8e23239;p=python-delta-tar adding support for filtering via whitelist with -inc --- diff --git a/backup.py b/backup.py index 41deb77..d15743d 100644 --- a/backup.py +++ b/backup.py @@ -69,6 +69,10 @@ if __name__ == "__main__": parser.add_argument("-l", "--list-files", action='store_true', help="List files in a tarball") parser.add_argument("-x", "--excluded", nargs='+', default=[], help="excluded files") + parser.add_argument("-inc", "--included", nargs='+', default=[], + help="included files") + parser.add_argument("-ip", "--included-path", default=None, + help="path to the file containing included paths") parser.add_argument("-xp", "--excluded-path", default=None, help="path to the file containing excluded paths") parser.add_argument("-e", "--equals", action='store_true', help="Checks two dirs are equal") @@ -82,8 +86,16 @@ if __name__ == "__main__": else: excluded_files = args.excluded + if args.included_path: + f = open(args.included_path, 'r') + included_files = f.readlines() + f.close() + else: + included_files = args.included + deltatar = DeltaTar(mode=args.mode, password=args.password, - logger=consoleLogger, excluded_files=excluded_files) + logger=consoleLogger, excluded_files=excluded_files, + included_files=included_files) if args.full: deltatar.create_full_backup(args.sourcepath, args.targetpath, args.volsize)