| 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) | |