Skip to content

Commit

Permalink
fixing an even more severe bug
Browse files Browse the repository at this point in the history
  • Loading branch information
novoid committed Sep 18, 2022
1 parent c07ec1f commit 063fe06
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions move2archive/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
PROG_VERSION = u"Time-stamp: <2022-09-18 17:04:19 vk>"
PROG_VERSION = u"Time-stamp: <2022-09-18 17:12:06 vk>"

import os
import sys
Expand Down Expand Up @@ -336,8 +336,10 @@ def move_item(item, destination):

if not options.dryrun:
if os.path.isdir(destination):
if os.path.isfile(os.path.join(destination, item)):
logging.warning('Cannot move "%s" to "%s" because it alreay exists. Skipping.' % (item, destination))
basename = os.path.basename(item)
destinationfilename = os.path.join(destination, basename)
if os.path.isfile(destinationfilename):
logging.warning('Cannot move "%s" to "%s" because it already exists. Skipping.' % (item, destinationfilename))
else:
try:
shutil.move(item, destination)
Expand Down

0 comments on commit 063fe06

Please sign in to comment.