def final_cleanup(self):
        if hasattr(self, "all_files"):
            for file_name in self.all_files:
                file_path, file_name_nopath = os.path.split(file_name)
                subdir = os.path.split(file_path)[1] if self.opts['subdir'] else ''
                dest_path = os.path.join(self.opts['path'], subdir)
                if os.path.abspath(file_path) == os.path.abspath(os.path.join(DATA_DIR, subdir)):
                    print ("%s is already in the working directory" %
                           file_name_nopath)
                    print("Keeping existing copy.")
                else:
                    print("Copying %s from %s" % (file_name_nopath, file_path))
                    if os.path.isdir(dest_path):
                        try:
                            shutil.copy(file_name, dest_path)
                        except:
                            print("Couldn't copy file to %s" % dest_path)
                    else:
                        try:
                            print("Creating directory %s" % dest_path)
                            os.makedirs(dest_path)
                            shutil.copy(file_name, dest_path)
                        except:
                            print("Couldn't create directory %s" % dest_path)
        self.all_files = set()
Copies downloaded files to desired directory
dataset/ETHPy150Open weecology/retriever/engines/download_only.py/engine.final_cleanup