Use os.renames() in remove() to auto-create subdirectories.

Bug: 1415507
Change-Id: Ie52123dc0844639116b55bc7f6a2734aaf7df33e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4378417
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Joanna Wang <jojwang@chromium.org>
changes/17/4378417/2
Joanna Wang 3 years ago committed by LUCI CQ
parent 857600b9ef
commit 489304d949

@ -366,8 +366,8 @@ def remove(target, cleanup_dir):
allfiles = os.listdir(target)
for f in allfiles:
target_path = os.path.join(target, f)
dst_path = os.path.join(destination, f)
os.rename(target_path, dst_path)
dst_path = os.path.join(dest, f)
os.renames(target_path, dst_path)
except Exception as e:
print('Error renaming %s to %s: %s' % (target, dest, str(e)))
raise

Loading…
Cancel
Save