diff --git a/gallery_dl/path.py b/gallery_dl/path.py index 1616bbda..bfb6136f 100644 --- a/gallery_dl/path.py +++ b/gallery_dl/path.py @@ -338,13 +338,13 @@ class PathFormat(): while True: try: os.replace(self.temppath, self.realpath) - except FileNotFoundError: - # delayed directory creation - os.makedirs(self.realdirectory) - continue except OSError: # move across different filesystems - shutil.copyfile(self.temppath, self.realpath) + try: + shutil.copyfile(self.temppath, self.realpath) + except FileNotFoundError: + os.makedirs(self.realdirectory) + shutil.copyfile(self.temppath, self.realpath) os.unlink(self.temppath) break