

def _download_one_folder(project, folder, strip_prefix, destdir, cached_folder_lists, args):
    assert folder.startswith(strip_prefix)
    if (not args.recursive):
        err_exit((('Error: "' + folder) + '" is a folder but the -r/--recursive option was not given'))
    for subfolder in _list_subfolders(project, folder, cached_folder_lists, recurse=True):
        _ensure_local_dir(os.path.join(destdir, subfolder[len(strip_prefix):].lstrip('/')))
    for f in dxpy.search.find_data_objects(classname='file', state='closed', project=project, folder=folder, recurse=True, describe=True):
        file_desc = f['describe']
        dest_filename = os.path.join(destdir, file_desc['folder'][len(strip_prefix):].lstrip('/'), file_desc['name'])
        download_one_file(project, file_desc, dest_filename, args)

dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/cli/download.py _download_one_folder/original