From 355191087f77a04d4cfb7d77125cdcb3d5d10d37 Mon Sep 17 00:00:00 2001 From: BO ZHANG <bozhang@nao.cas.cn> Date: Fri, 21 Oct 2022 18:53:26 +0800 Subject: [PATCH] added functions to remove files/directory --- csst_common/utils/_io.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 csst_common/utils/_io.py diff --git a/csst_common/utils/_io.py b/csst_common/utils/_io.py new file mode 100644 index 0000000..70ec85b --- /dev/null +++ b/csst_common/utils/_io.py @@ -0,0 +1,18 @@ +import glob +import os +import shutil + + +def remove_files(fmt=""): + """ Remove files matching the specified format. """ + for fp in glob.glob(fmt): + os.remove(fp) + + +def remove_dir(path=""): + """ Remove the specified directory. """ + shutil.rmtree(path) + + + + -- GitLab