print(args) raise ValueError("Unknown hasher specified") fh.setCache(cache) fh.initialize() wrt = Writer(args['destination'], args['source']) wrt.initialize() files = analyzer.getFilesWithFullHashes('random', max(args['min'], math.ceil(analyzer.getFilesWithFullHashesCount()*(args['percent']/100))) ) failedChecks = [] for (np, fhash, fullHash, np_size, np_ctime, np_mtime, np_atime) in files: op = wrt.getDestinationFilePath(np) path = Path(wrt.getDestinationFilePathToContent(op), False) path.size = np_size hashMatches = False if args['fast']: pathSrc = Path(wrt.getSourceFilePath(op), False) pathSrc.ctime = np_ctime pathSrc.mtime = np_mtime pathSrc.atime = np_atime try: pathSrc.size = getsize(op) except (OSError) as e: pathSrc.size = -1
if args['doApply']: cache.log("[%s] remove path %s, onlyFromCache: %d" % (os.path.basename(__file__), path, args['onlyFromCache'])) p = Path.Path(path, False) if cache.findFileByPath(p.path): print("try to delete %s" % (p.path)) cache.log(" [%s] remove %s" % (os.path.basename(__file__), p.path)) cache.deleteFileFromFiles(p) if not args['onlyFromCache']: try: print(" copy backup file to history") wrtbackup.deleteFile(p) print(" ... done") except (OSError, IOError) as e: print(" ...error: %s" % e.strerror) print(" ...the backup was altered externally. Is the HDD broken?") try: print(" wrt.deleteFile(%s)" % (wrt.getDestinationFilePath(p.path))) wrt.deleteFile(p) print(" ... deleted from the backup(for real). Please re-run the backup process") except (OSError, IOError): print(" ...error: %s" % e.strerror) print(" ...the backup was altered externally. Is the HDD broken?") else: raise Exception("Cannot find specified path for deletion") cache.commit() cache.destroy()
(os.path.basename(__file__), p.path)) cache.deleteFileFromFiles(p) if not args['onlyFromCache']: try: print(" copy backup file to history") wrtbackup.deleteFile(p) print(" ... done") except (OSError, IOError) as e: print(" ...error: %s" % e.strerror) print( " ...the backup was altered externally. Is the HDD broken?" ) try: print(" wrt.deleteFile(%s)" % (wrt.getDestinationFilePath(p.path))) wrt.deleteFile(p) print( " ... deleted from the backup(for real). Please re-run the backup process" ) except (OSError, IOError): print(" ...error: %s" % e.strerror) print( " ...the backup was altered externally. Is the HDD broken?" ) else: raise Exception("Cannot find specified path for deletion") cache.commit() cache.destroy()
fh.setCache(cache) fh.initialize() wrt = Writer(args['destination'], args['source']) wrt.initialize() files = analyzer.getFilesWithFullHashes( 'random', max( args['min'], math.ceil(analyzer.getFilesWithFullHashesCount() * (args['percent'] / 100)))) failedChecks = [] for (np, fhash, fullHash, np_size, np_ctime, np_mtime, np_atime) in files: op = wrt.getDestinationFilePath(np) path = Path(wrt.getDestinationFilePathToContent(op), False) path.size = np_size hashMatches = False if args['fast']: pathSrc = Path(wrt.getSourceFilePath(op), False) pathSrc.ctime = np_ctime pathSrc.mtime = np_mtime pathSrc.atime = np_atime try: pathSrc.size = getsize(op) except (OSError) as e: pathSrc.size = -1