From 592d3b4c15ea41ce53072a3f40d85ccbb4274521 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 24 Feb 2024 23:43:53 +0100 Subject: [PATCH] just committing the file for moving mapchooser and zr settings over --- file_mover/move.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 file_mover/move.py diff --git a/file_mover/move.py b/file_mover/move.py new file mode 100644 index 00000000..06ef38a2 --- /dev/null +++ b/file_mover/move.py @@ -0,0 +1,37 @@ +#!/home/gameservers/mv_map_restrictions/venv/bin/python3 +import paramiko +import sys +import os + +host = sys.argv[1] +user = sys.argv[2] +pw = sys.argv[3] + +def upload_folder(sftp, source_folder, dest_folder): + for root, dirs, files in os.walk(source_folder): + for file in files: + source_path = os.path.join(root, file) + dest_path = os.path.join(dest_folder, os.path.relpath(source_path, source_folder)) + try: + sftp.put(source_path, dest_path) + except Exception: + pass + +source_file = "/home/gameservers/css_ze/cstrike/addons/sourcemod/configs/mapchooser_extended.cfg" +source_file2 = "/home/gameservers/css_ze/torchlight3/triggers.json" +source_file3 = "/home/gameservers/css_zr/cstrike/addons/sourcemod/configs/unloze_zr/" +dest_file = "/home/nonroot/html/mapchooser_css_ze/mapchooser_extended.cfg" +dest_file2 = "/home/nonroot/html/torch_sounds_ze/triggers.json" +dest_file3 = "/home/nonroot/html/unloze_zr/" + + +transport = paramiko.Transport((host, int(22))) +transport.connect(username = user, password = pw) +sftp = paramiko.SFTPClient.from_transport(transport) +sftp.put(source_file, dest_file) +sftp.put(source_file2, dest_file2) +upload_folder(sftp, source_file3, dest_file3) + +del sftp +transport.close() +