示例#1
0
def preview_pipes(folder_path):
    if context.ids_roi(context.roitp):
        for pipe_path in common.pipes_paths(folder_path):
            if context.ids_ignorable(pipe_path): pass
            elif context.ids_replaceable_last(pipe_path):
                shower.show_red_tipped(pipe_path)
                shower.show_green_tipped(
                    common.replacement_last(pipe_path, context.regex,
                                            context.token))
示例#2
0
def preview_link(link_path):
    headed = False
    if context.ids_roi(context.roitk):
        if context.ids_replaceable_last(link_path):
            shower.show_red_tipped(link_path)
            shower.show_green_tipped(
                common.replacement_last(link_path, context.regex,
                                        context.token))
            headed = True
    preview_terl(link_path, headed)
示例#3
0
def replace_file_in_file(file_path):
    if context.ids_ignorable(file_path): pass
    elif context.ids_replaceable_last(file_path):
        source_file_path = file_path
        target_file_path = common.replacement_last(file_path, context.regex,
                                                   context.token)
        try:
            os.makedirs(os.path.dirname(target_file_path))
        except IOError:
            pass
        os.rename(source_file_path, target_file_path)
示例#4
0
def preview_folder(folder_path):
    if context.ids_roi(context.roitd):
        if context.ids_replaceable_last(folder_path):
            shower.show_red_tipped(folder_path)
            shower.show_green_tipped(
                common.replacement_last(folder_path, context.regex,
                                        context.token))
    preview_files(folder_path)
    preview_links(folder_path)
    preview_pipes(folder_path)
    preview_folders(folder_path)
示例#5
0
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)
示例#6
0
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)
示例#7
0
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)