cacheNew.initialize() cacheNew.log("[%s] start" % (os.path.basename(__file__))) cacheOld = sqlite.sqlite() cacheOld.setCacheLocation(args["cacheOld"]) cacheOld.initialize() doApply = True cmpr = CompleteComparer() cmpr.setNewCache(cacheNew) cmpr.setOldCache(cacheOld) cmpr.initialize() wrt = Writer(args["destination"], args["source"]) wrt.initialize() wrt.registerProgressCallback(callbackWriter) wrtbackup = BackupWriter(args["destinationBackup"], args["destination"], args["source"], time.strftime("%Y%m%d%H%M%S")) wrtbackup.initialize() cacheNew.log("[%s] initialized" % (os.path.basename(__file__))) logging.info("moved files:") for paths in cmpr.getMovedFiles(): logging.info(" ren %s --> %s" % (paths[1], paths[0])) if doApply:
if args['Hasher'] == 'FastContentHashV1.Cached': fh = Hasher.FastContentHashV1.Cached() elif args['Hasher'] == 'FastContentHashV2.Cached': fh = Hasher.FastContentHashV2.Cached() elif args['Hasher'] == 'FastContentHashV2.Cached_noInode': fh = Hasher.FastContentHashV2.Cached_noInode() elif args['Hasher'] == 'FastAttributeHashV1.Cached': fh = Hasher.FastAttributeHashV1.Cached() else: 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
cache.setCacheLocation(args['cache']) cache.initialize() if args['destination'] == 'auto': args['destination'] = cache.getFlag('destination.path') print "autoload destination: %s" % (args['destination']) if args['source'] == 'auto': args['source'] = cache.getFlag('source.path') print "autoload source: %s" % (args['source']) if args['destinationBackup'] == 'auto': args['destinationBackup'] = cache.getFlag('destinationBackup.path') print "autoload destinationBackup: %s" % (args['destinationBackup']) wrt = Writer(args['destination'], args['source']) wrt.initialize() wrtbackup = BackupWriter(args['destinationBackup'], args['destination'], args['source'], time.strftime("%Y%m%d%H%M%S")) wrtbackup.initialize() #glob.glob('./[0-9].*') paths = cache.findFilesByPath(args['path'].replace("*", "%")) print("trying to delete %d paths from %s" % (len(paths), args['path'])) for (path, ) in paths: print(" remove %s" % (path)) if args['doApply']: cache.log("[%s] remove path %s, onlyFromCache: %d" %
if args['destination']=='auto': args['destination'] = cache.getFlag('destination.path') print "autoload destination: %s" % (args['destination']) if args['source']=='auto': args['source'] = cache.getFlag('source.path') print "autoload source: %s" % (args['source']) if args['destinationBackup']=='auto': args['destinationBackup'] = cache.getFlag('destinationBackup.path') print "autoload destinationBackup: %s" % (args['destinationBackup']) wrt = Writer(args['destination'], args['source']) wrt.initialize() wrtbackup = BackupWriter(args['destinationBackup'], args['destination'], args['source'], time.strftime("%Y%m%d%H%M%S")) wrtbackup.initialize() #glob.glob('./[0-9].*') paths = cache.findFilesByPath(args['path'].replace("*", "%")) print("trying to delete %d paths from %s" % (len(paths), args['path'])) for (path, ) in paths: print (" remove %s" % (path)) if args['doApply']: cache.log("[%s] remove path %s, onlyFromCache: %d" % (os.path.basename(__file__), path, args['onlyFromCache'])) p = Path.Path(path, False)
cacheNew.initialize() cacheNew.log("[%s] start" % (os.path.basename(__file__))) cacheOld = sqlite.sqlite() cacheOld.setCacheLocation(args['cacheOld']) cacheOld.initialize() doApply = True cmpr = CompleteComparer() cmpr.setNewCache(cacheNew) cmpr.setOldCache(cacheOld) cmpr.initialize() wrt = Writer(args['destination'], args['source']) wrt.initialize() wrt.registerProgressCallback(callbackWriter) wrtbackup = BackupWriter(args['destinationBackup'], args['destination'], args['source'], time.strftime("%Y%m%d%H%M%S")) wrtbackup.initialize() cacheNew.log("[%s] initialized" % (os.path.basename(__file__))) if cacheNew.getFlag('destination.path') is None: cacheNew.setFlag('destination.cache.path', args['cacheOld']) cacheNew.setFlag('destination.path', args['destination']) cacheNew.setFlag('destinationBackup.path', args['destinationBackup'])
cache = sqlite.sqlite(); cache.setCacheLocation(args['cache']) cache.initialize() if args['destination']=='auto': args['destination'] = cache.getFlag('destination.path') print "autoload destination: %s" % (args['destination']) if args['source']=='auto': args['source'] = cache.getFlag('source.path') print "autoload source: %s" % (args['source']) wrt = Writer(args['destination'], args['source']) wrt.initialize() #glob.glob('./[0-9].*') paths = cache.findFilesByPath(args['path'].replace("*", "%")) print "trying to delete %d paths from %s" % (len(paths), args['path']) for (path, ) in paths: print (" remove %s" % (path)) 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): cache.deleteFileFromFiles(p) if not args['onlyFromCache']:
if args['Hasher'] == 'FastContentHashV1.Cached': fh = Hasher.FastContentHashV1.Cached() elif args['Hasher'] == 'FastContentHashV2.Cached': fh = Hasher.FastContentHashV2.Cached() elif args['Hasher'] == 'FastContentHashV2.Cached_noInode': fh = Hasher.FastContentHashV2.Cached_noInode() elif args['Hasher'] == 'FastAttributeHashV1.Cached': fh = Hasher.FastAttributeHashV1.Cached() else: 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