如何将文件夹从 AzureML 笔记本文件夹下载到本地或 Blob 存储?

sim*_*ong 4 python azure azure-storage azure-blob-storage azure-machine-learning-service

当我使用 AzureML jupyter 时,我使用 (./folder_name) 将文件保存到同一目录。现在如何下载到本地计算机或 Blob 存储?

该文件夹中有很多文件和子目录,这是我在网上抓取的。所以一一保存不太现实。

file_path = "./"

for i in target_key_word:
    tem_str = i.replace(' ', '+')
    dir_name = file_path + i
    if not os.path.exists(dir_name):
        os.mkdir(dir_name)
    else:    
        print("Directory " , dir_name ,  " already exists")
Run Code Online (Sandbox Code Playgroud)

小智 12

感谢这是一个老问题,但对于其他有这个问题的人来说,这就是我的做法。

  1. 在 Azure ML Notebooks 主页中打开一个新的终端窗口。

  2. 使用以下命令压缩整个目录:

     zip -r myfiles.zip . 
    
    Run Code Online (Sandbox Code Playgroud)
  3. 刷新文件夹资源管理器并下载 zip 文件。

  • 这个答案非常聪明,非常感谢。 (3认同)