File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -306,14 +306,16 @@ def copy_structure(
306
306
dst_root (str): Path to the target root of the tree structure.
307
307
308
308
"""
309
- _src_root = src_fs .validatepath (src_root )
310
- _dst_root = dst_fs .validatepath (dst_root )
311
- # It's not allowed to copy a structure into itself
312
- if src_fs == dst_fs and isbase (_src_root , _dst_root ):
313
- raise IllegalDestination (dst_root )
314
309
walker = walker or Walker ()
315
310
with manage_fs (src_fs ) as _src_fs :
316
311
with manage_fs (dst_fs , create = True ) as _dst_fs :
312
+ _src_root = _src_fs .validatepath (src_root )
313
+ _dst_root = _dst_fs .validatepath (dst_root )
314
+
315
+ # It's not allowed to copy a structure into itself
316
+ if _src_fs == _dst_fs and isbase (_src_root , _dst_root ):
317
+ raise IllegalDestination (dst_root )
318
+
317
319
with _src_fs .lock (), _dst_fs .lock ():
318
320
_dst_fs .makedirs (_dst_root , recreate = True )
319
321
for dir_path in walker .dirs (_src_fs , _src_root ):
You can’t perform that action at this time.
0 commit comments