aboutsummaryrefslogtreecommitdiffstats
path: root/python/ice.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/ice.py')
-rw-r--r--python/ice.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/ice.py b/python/ice.py
new file mode 100644
index 00000000..af3fd3db
--- /dev/null
+++ b/python/ice.py
@@ -0,0 +1,21 @@
+try:
+ from serenitas.utils.env import DAILY_DIR
+except KeyError:
+ sys.exit("Please set 'DAILY_DIR' in the environment")
+
+from serenitas.utils.remote import SftpClient
+
+
+def download_files():
+ sftp = SftpClient.from_creds("ice")
+ dst = DAILY_DIR / "ICE_reports"
+ import stat
+
+ for f in sftp.client.listdir_attr("/"):
+ local_file = dst / f.filename
+ if (not local_file.exists()) and (not stat.S_ISDIR(f.st_mode)):
+ sftp.client.get(f"//{f.filename}", localpath=local_file)
+
+
+if __name__ == "__main__":
+ download_files()