if mode != "full":
print("** Warning: full backup recommended!")
- # Create new target directory
- basedir = self.conf.directory
- dirname = Backup.getDirName(now, epoch, mode)
- tmpdirname = dirname + ("-%x" % (random.random()*2e16) )
- targetdir = os.path.join(basedir, tmpdirname)
- os.mkdir( targetdir )
# If we have a full backup, we backup everything
since = None
-
- # Get latest full backup time
if mode == "diff":
since = sorted(oldfullbackups, key=lambda b: b.date)[-1].date
- # Get latest backup time
elif mode == "incr":
since = sorted(oldbackups, key=lambda b: b.date)[-1].date
+ if since != None:
+ print("Making backup relative to ", since.ctime())
+
+ yesno = self.ask_user_yesno("Proceed? [Y, n] ")
+ if yesno == "n":
+ return
+
+ # Create new target directory
+ basedir = self.conf.directory
+ dirname = Backup.getDirName(now, epoch, mode)
+ tmpdirname = dirname + ("-%x" % (random.random()*2e16) )
+ targetdir = os.path.join(basedir, tmpdirname)
+ os.mkdir( targetdir )
+
+
# Backup all file sets
for s in self.conf.sets:
self.backupFileSet(s, targetdir, since)
return
basedir = self.conf.directory
- yesno = self.ask_user_yesno("Remove entries marked by '*'?")
+ yesno = self.ask_user_yesno("Remove entries marked by '*'? [y, N] ")
if yesno == "y":
for d in removeDirs:
shutil.rmtree(os.path.join(basedir, d))
print(question + " y")
return "y"
else:
- return input(question + " [y, N] ")
+ return input(question)
def printUsage():