Skip to content

Commit d7a9987

Browse files
authored
Revert "Sample - Fix exports from Workspace to Windows FS (#448)" (#516)
This reverts commit c695b8d.
1 parent dd79c75 commit d7a9987

File tree

1 file changed

+5
-8
lines changed
  • databricks_cli/workspace

1 file changed

+5
-8
lines changed

databricks_cli/workspace/api.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
# limitations under the License.
2323

2424
import os
25-
import re
2625
from base64 import b64encode, b64decode
2726

2827
import click
@@ -36,7 +35,6 @@
3635
NOTEBOOK = 'NOTEBOOK'
3736
LIBRARY = 'LIBRARY'
3837
REPO = 'REPO'
39-
LOCAL_OS_COMPATIBLE_PATH_REGEX = r'[^\w\-_\. ]' + re.escape(os.sep)
4038

4139

4240
class WorkspaceFileInfo(object):
@@ -168,16 +166,15 @@ def import_workspace_dir(self, source_path, target_path, overwrite, exclude_hidd
168166
'continue.').format(cur_src, extensions))
169167

170168
def export_workspace_dir(self, source_path, target_path, overwrite, headers=None):
171-
os_compatible_target_path = re.sub(LOCAL_OS_COMPATIBLE_PATH_REGEX, '_', target_path)
172-
if os.path.isfile(os_compatible_target_path):
169+
if os.path.isfile(target_path):
173170
click.echo('{} exists as a file. Skipping this subtree {}'
174-
.format(os_compatible_target_path, source_path))
171+
.format(target_path, source_path))
175172
return
176-
if not os.path.isdir(os_compatible_target_path):
177-
os.makedirs(os_compatible_target_path)
173+
if not os.path.isdir(target_path):
174+
os.makedirs(target_path)
178175
for obj in self.list_objects(source_path, headers=headers):
179176
cur_src = obj.path
180-
cur_dst = os.path.join(os_compatible_target_path, obj.basename)
177+
cur_dst = os.path.join(target_path, obj.basename)
181178
if obj.is_dir:
182179
self.export_workspace_dir(cur_src, cur_dst, overwrite, headers=headers)
183180
elif obj.is_notebook:

0 commit comments

Comments
 (0)