Skip to content

Commit a559241

Browse files
committed
Fix issue when files already exist
1 parent 4761d34 commit a559241

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

adafruit_shell.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ def move(self, source, destination):
339339
source = self.path(source)
340340
destination = self.path(destination)
341341
if os.path.exists(source):
342+
if not os.path.isdir(source) and os.path.isdir(destination):
343+
destination += os.sep + os.path.basename(source)
342344
shutil.move(source, destination)
343345

344346
def copy(self, source, destination):
@@ -351,6 +353,8 @@ def copy(self, source, destination):
351353
if os.path.isdir(source):
352354
shutil.copytree(source, destination)
353355
else:
356+
if os.path.isdir(destination):
357+
destination += os.sep + os.path.basename(source)
354358
shutil.copy(source, destination)
355359

356360
def remove(self, location):

0 commit comments

Comments
 (0)