File size: 668 Bytes
4d5aebb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import shutil
from pathlib import Path 
import time

copied = []
while True:
    existing = [x.name for x in Path(".").glob("*.bin")]
    copy_from = [x for x in Path("/home/fella/mnt/selectel/tiny-llama/").glob("*.bin")]
    for file in copy_from:
        if file.name not in existing:
            print(file)
            try:
                shutil.copy(file, file.name)
                copied.append(file.name)
                if len(copied) > 6:
                    delete_me = copied.pop(0)
                    Path(delete_me).unlink()
            except Exception as e:
                print(f"Skipping {file.name}: {e}")
                pass
    time.sleep(15)