Export all shell commands from files in the file index into given directory

def export_shell(file_index, to_dir):
    """
    Export all shell commands from files in the file index into given directory
    """
    if not exists(to_dir):
        makedirs(to_dir)

    for _, file_data in file_index.files.items():
        export_from_file(file_data, to_dir)