diff --git a/fusion_report/common/net.py b/fusion_report/common/net.py index cb02165..00e5f28 100644 --- a/fusion_report/common/net.py +++ b/fusion_report/common/net.py @@ -206,12 +206,11 @@ def get_mitelman(self, return_err: List[str]) -> None: @staticmethod def clean(): - """Remove all files except *db.""" - for temp in glob.glob("*/"): - shutil.rmtree(temp) - for temp in glob.glob("*[!.db]"): - if not os.path.isdir(temp): - os.remove(temp) + """Remove all files except *db and move to output dir.""" + for temp in glob.glob("*.db"): + shutil.copy(temp, "../") + os.chdir("../") + shutil.rmtree("tmp_dir") @staticmethod def timestamp(): diff --git a/fusion_report/download.py b/fusion_report/download.py index fec94a9..e739d32 100644 --- a/fusion_report/download.py +++ b/fusion_report/download.py @@ -35,7 +35,10 @@ def download_all(self, params: Namespace) -> None: """Download all databases.""" return_err: List[str] = [] - os.chdir(params.output) + tmp_dir = os.path.join(params.output, "tmp_dir") + if not os.path.exists(tmp_dir): + os.mkdir(tmp_dir) + os.chdir(tmp_dir) if not params.no_mitelman: # MITELMAN