def save_flash_files(dump_location, clear=False): """ save all files from the default flash storage locations clear: sets whether to clear storage locations after backup """ if not os.path.isdir(dump_location): os.makedirs(dump_location) #Copy all flash objects over to dump location for location in FLASH_LOCS: if not os.path.isdir(location): print "WARNING: "+location+" not found, skipping..." continue print "SAVING: " + location (head, tail) = os.path.split(location) #Remove old backups if exist if os.path.exists(os.path.join(dump_location,tail)): shutil.rmtree(os.path.join(dump_location,tail)) #Make new backups shutil.copytree(location, os.path.join(dump_location,tail)) if clear: print "CLEARING: " + location rmsubtree(location)
def save_flash_files(dump_location, clear=False): """ save all files from the default flash storage locations clear: sets whether to clear storage locations after backup """ if not os.path.isdir(dump_location): os.makedirs(dump_location) #Copy all flash objects over to dump location for location in FLASH_LOCS: if not os.path.isdir(location): print "WARNING: " + location + " not found, skipping..." continue print "SAVING: " + location (head, tail) = os.path.split(location) #Remove old backups if exist if os.path.exists(os.path.join(dump_location, tail)): shutil.rmtree(os.path.join(dump_location, tail)) #Make new backups shutil.copytree(location, os.path.join(dump_location, tail)) if clear: print "CLEARING: " + location rmsubtree(location)
def save_flash_files(logger, browser_params, dump_location, clear=False): """ save all files from the default flash storage locations clear: sets whether to clear storage locations after backup """ if not os.path.isdir(dump_location): os.makedirs(dump_location) #Copy all flash objects over to dump location for location in FLASH_LOCS: if not os.path.isdir(location): logger.warning("BROWSER %i: %s not found when attempting to save flash files, skipping..." % (browser_params['crawl_id'], location)) continue logger.debug("BROWSER %i: SAVING %s during flash file archive" % (browser_params['crawl_id'], location)) (head, tail) = os.path.split(location) #Remove old backups if exist if os.path.exists(os.path.join(dump_location,tail)): shutil.rmtree(os.path.join(dump_location,tail)) #Make new backups shutil.copytree(location, os.path.join(dump_location,tail)) if clear: logger.debug("BROWSER %i: CLEARING %s during flash file archive" % (browser_params['crawl_id'], location)) rmsubtree(location)
def clear_all_flash(): """ clear all flash locations """ for location in FLASH_LOCS: print "CLEARING: " + location rmsubtree(location)