def select_data(in_path,out_path,prefix="bin"): dirs.make_dir(out_path) all_files=dirs.get_files(in_path) prefix_files=[f for f in all_files if files.extract_prefix(str(f))==prefix] out_files=[out_path.create(path_i.get_name()) for path_i in prefix_files] for in_file,out_file in zip(in_prefix_files,out_prefix_files): shutil.copyfile(in_file, out_file) print(in_file)
def action_cats(action_path,out_path): dirs.make_dir(out_path) action_paths=dirs.get_files(action_path,dirs=True) actions=[ read_action(path_i,False) for path_i in action_paths] cats={} for action_i in actions: cats[action_i.cat]=out_path.create(action_i.cat) for cat_i in cats.keys(): dirs.make_dir(cats[cat_i]) for action_i in actions: name=action_i.name cat_path=cats[action_i.cat] dst_path=cat_path.create(name) print(str(dst_path)) action_i.save(dst_path)