def replace_lines_in_folder(folder_path): if context.ids_ignorable(folder_path): pass else: for subfolder_path in common.folders_paths(folder_path): replace_lines_in_folder(subfolder_path) for file_path in common.files_paths(folder_path): replace_lines_in_file(file_path)
def replace_pipes_in_folder(folder_path): if context.ids_ignorable(folder_path): pass else: for subfolder_path in common.folders_paths(folder_path): replace_pipes_in_folder(subfolder_path) for pipe_path in common.pipes_paths(folder_path): if context.ids_ignorable(pipe_path): pass elif context.ids_replaceable_last(pipe_path): source_pipe_path = pipe_path target_pipe_path = common.replacement_last( pipe_path, context.regex, context.token) os.rename(source_pipe_path, target_pipe_path)
def replace_terls_in_folder(folder_path): if context.ids_ignorable(folder_path): pass else: for subfolder_path in common.folders_paths(folder_path): replace_terls_in_folder(subfolder_path) for link_path in common.links_paths(folder_path): if context.ids_ignorable(link_path): pass else: source_terminal = os.path.realpath(link_path) if context.ids_replaceable(source_terminal): target_terminal = common.replacement_all( source_terminal, context.regex, context.token) os.remove(link_path) os.symlink(target_terminal, link_path)
def replace_links_in_folder(folder_path): if context.ids_ignorable(folder_path): pass else: for subfolder_path in common.folders_paths(folder_path): replace_links_in_folder(subfolder_path) for link_path in common.links_paths(folder_path): if context.ids_ignorable(link_path): pass elif context.ids_replaceable_last(link_path): source_link_path = link_path target_link_path = common.replacement_last( link_path, context.regex, context.token) terminal = os.path.realpath(source_link_path) os.remove(source_link_path) os.symlink(terminal, target_link_path)
def replace_folders_in_folder(folder_path): if context.ids_ignorable(folder_path): pass else: for subfolder_path in common.folders_paths(folder_path): replace_folders_in_folder(subfolder_path) if context.ids_replaceable_last(folder_path): source_folder_path = folder_path target_folder_path = common.replacement_last( folder_path, context.regex, context.token) try: os.makedirs(target_folder_path) except Error: pass os.rename(source_folder_path, target_folder_path)
def preview_folders(folder_path): for subfolder_path in common.folders_paths(folder_path): if context.ids_ignorable(subfolder_path): pass else: preview_folder(subfolder_path)