Reputation: 41
I saved file to the same directory using (./folder_name) when I use AzureML jupyter. Now how can I download to my local machine or blob storage?
The folder have a lot of files and sub-directory in it, which I scraped online. So it is not realistic to save one by one.
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")
Upvotes: 4
Views: 12328
Reputation: 26676
from azureml.core import Workspace, Datastore, Dataset
import os from datetime import datetime
workspace_name = "<your_workspace_name>" resource_group = "<your_resource_group>" subscription_id = "<your_subscription_id>"
ws = Workspace.get( name=workspace_name, resource_group=resource_group, subscription_id=subscription_id )
datastore = ws.get_default_datastore()
user_folder = "path/to/user/folder"
all_files = datastore.blob_service.list_blobs(datastore.container_name, prefix=user_folder)
file_details = [ { "name": blob.name, "last_modified": blob.properties.last_modified } for blob in all_files ]
sorted_files = sorted(file_details, key=lambda x: x["last_modified"], reverse=True)
latest_files = sorted_files[:5]
print("Latest 5 Modified Files:") for file in latest_files: print(f"File: {file['name']}, Last Modified: {file['last_modified']}")
Upvotes: 0
Reputation: 141
Appreciate this is an old question but for anyone else with this questions this is how I did it.
Open a new terminal window in your Azure ML Notebooks homepage.
Zip up the entire directory with:
zip -r myfiles.zip .
Refresh the folder explorer and download the zip file.
Upvotes: 13
Reputation: 52
Another option for downloading Notebooks is to go through the azure ML studio UI to "Edit in VS Code." Once you have it open in VS Code, right click the folder and there is an option "Download" You can save these files to local and then re-upload as needed.
Upvotes: 0
Reputation: 572
If you are asking how you could download all your files and folders from the Notebooks GUI of Azure ML Studio, I wish there was a straightforward way to do so. As far as I know, you could do the following for now:
Open in Explorer
.File Shares
folder and find the folder prefixed code-
. This is where you will find all your files and folders, which you can download to your local in bulk.Upvotes: 3
Reputation: 4164
From my understanding you would like to download the project files :
You could do one of the below :
From the project page, click the "Download Project" button to download all the files of a given project.
OR
Go to Azure Notebooks and sign in.
From your public profile page, select My Projects at the top of the page.
My Projects link on the top of the browser window
Select the project.
Click the download Download button to trigger a zip file download that contains all of your project files.
Upvotes: 0