File size: 336 Bytes
9bd4ce5
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
import os
from pathlib import Path

log_dir = Path("alphazero/logs/loops")
files = sorted(log_dir.glob("*.txt"), key=os.path.getmtime, reverse=True)
if files:
    with open("tmp_latest_log_path.txt", "w") as f:
        f.write(str(files[0].absolute()))
    print(f"Path written: {files[0].name}")
else:
    print("No log files found.")