#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Vyjme obri slozky z checkpointu, aby se znovu proскenovaly (uz bez wedge, kdyz je C: opravene). Male slozky v checkpointu nejsou -> zpracuji se samy.""" import paramiko REMOVE = { "vladimir.buzalka@buzalka.cz/Exchange vladimir.buzalka/Odstraněná pošta", "vladimir.buzalka@buzalka.cz/Exchange vladimir.buzalka/Doručená pošta", } c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("192.168.1.76", username="root", password="7309208104", timeout=10) sftp = c.open_sftp() path = "/mnt/user/Scripts/MailStore/ingest_done.txt" with sftp.open(path, "r") as f: lines = [ln.rstrip("\n") for ln in f.read().decode("utf-8").splitlines()] kept = [l for l in lines if l.strip() and l.strip() not in REMOVE] removed = len(lines) - len(kept) with sftp.open(path, "w") as f: f.write("\n".join(kept) + "\n") print(f"puvodne radku: {len(lines)} odebrano: {removed} zbylo: {len(kept)}") sftp.close(); c.close()