mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-28 10:33:59 +00:00
Make new_file variable ony after checking if old file exists
This commit is contained in:
@@ -357,12 +357,12 @@ class File(QtCore.QObject, Item):
|
||||
pattern_regex = re.compile(fnmatch.translate(pattern), re.IGNORECASE)
|
||||
for old_file in os.listdir(old_path):
|
||||
if pattern_regex.match(old_file):
|
||||
new_file = os.path.join(new_path, old_file)
|
||||
old_file = os.path.join(old_path, old_file)
|
||||
# FIXME we shouldn't do this from a thread!
|
||||
if self.tagger.files.get(decode_filename(old_file)):
|
||||
log.debug("File loaded in the tagger, not moving %r", old_file)
|
||||
continue
|
||||
new_file = os.path.join(new_path, old_file)
|
||||
log.debug("Moving %r to %r", old_file, new_file)
|
||||
shutil.move(old_file, new_file)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user