Skip to content

Commit e389294

Browse files
Remove file path section
1 parent 0671bcb commit e389294

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

articles/storage/blobs/storage-blob-delete-python.md

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -60,53 +60,6 @@ The following code example gets the latest version of a deleted blob, and restor
6060

6161
:::code language="python" source="~/azure-storage-snippets/blobs/howto/python/blob-devguide-py/blob-devguide-blobs.py" id="Snippet_restore_blob_version":::
6262

63-
## Restore soft-deleted blobs and directories (hierarchical namespace)
64-
65-
> [!IMPORTANT]
66-
> This section applies only to accounts that have a hierarchical namespace.
67-
68-
1. Install version `12.4.0` or greater of the Azure Data Lake Storage client library for Python by using [pip](https://pypi.org/project/pip/). This command installs the latest version of the Azure Data Lake Storage client library for Python.
69-
70-
```
71-
pip install azure-storage-file-datalake
72-
```
73-
74-
2. Add these import statements to the top of your code file.
75-
76-
```python
77-
import os, uuid, sys
78-
from azure.storage.filedatalake import DataLakeServiceClient
79-
from azure.storage.filedatalake import FileSystemClient
80-
```
81-
82-
3. The following code deletes a directory, and then restores a soft-deleted directory.
83-
84-
The code example below contains an object named `service_client` of type **DataLakeServiceClient**. To see examples of how to create a **DataLakeServiceClient** instance, see [Authorize access and connect to data resources](data-lake-storage-directory-file-acl-python.md#authorize-access-and-connect-to-data-resources).
85-
86-
```python
87-
def restoreDirectory():
88-
89-
try:
90-
global file_system_client
91-
92-
file_system_client = service_client.create_file_system(file_system="my-file-system")
93-
94-
directory_path = 'my-directory'
95-
directory_client = file_system_client.create_directory(directory_path)
96-
resp = directory_client.delete_directory()
97-
98-
restored_directory_client = file_system_client.undelete_path(directory_client, resp['deletion_id'])
99-
props = restored_directory_client.get_directory_properties()
100-
101-
print(props)
102-
103-
except Exception as e:
104-
print(e)
105-
106-
```
107-
108-
If you rename the directory that contains the soft-deleted items, those items become disconnected from the directory. If you want to restore those items, you'll have to revert the name of the directory back to its original name or create a separate directory that uses the original directory name. Otherwise, you'll receive an error when you attempt to restore those soft-deleted items.
109-
11063
## Resources
11164

11265
To learn more about how to delete blobs and restore deleted blobs using the Azure Blob Storage client library for Python, see the following resources.

0 commit comments

Comments
 (0)