import subprocess import datetime def log(msg: str) -> None: # Use timezone-aware UTC datetime now = datetime.datetime.now(datetime.UTC) timestamp = now.isoformat().replace("+00:00", "Z") print(f"[{timestamp}] {msg}") def run_rawcopy(): # Full path to rawcopy.exe rawcopy_exe = r"C:\Temp\EXE\rawcopy.exe" args = [ rawcopy_exe, "/FileNamePath:c:0", "/OutputPath:C:\\Temp\\projects\\fileCollector\\Collection", "/OutputName:MFT_C" ] try: log("Running RawCopy with arguments:") log(" ".join(args)) result = subprocess.run(args, capture_output=True, text=True) if result.stdout: print("Output:\n", result.stdout) if result.stderr: print("Errors:\n", result.stderr) if result.returncode == 0: log("RawCopy completed successfully.") else: log(f"RawCopy exited with code {result.returncode}") except FileNotFoundError: log("Error: rawcopy.exe not found at specified path.") except Exception as e: log(f"Unexpected error: {e}") if __name__ == "__main__": log("Session start") run_rawcopy() log("Session end")