4 ms·
Show HN: Thanos-CLI – a Python tool that deletes half your files
Hi HN,
I built a small command-line tool inspired by Thanos’s snap.
It selects randomly exactly half the files in a directory and (optionally) deletes them.
Repo: https://github.com/soldatov-ss/thanos https://github.com/soldatov-ss/thanos
PyPI: https://pypi.org/project/thanos-cli/ https://pypi.org/project/thanos-cli/
It’s intentionally simple — feedback is welcome.
- d3Xt3r 11mo ago> exactly half the files in a directory What if there are an odd number of files, does it delete half a file then?
- stranger-ss 11mo agoIf the number of files is odd, Thanos keeps things simple - no fractional file slicing yet Example: 11 files -> deletes 5, keeps 6 (because 11 // 2 = 5) 1 file -> deletes 0, keeps 1
- d3Xt3r 11mo agoI reckon you should change it to delete half a file in such a case, it'll be pretty funny (basically call truncate(), and also rename the file to half the original name, heh).
- ggm 11mo agoWhich of . And .. does it delete?
- stranger-ss 11mo agoThanos deletes files of the directory you’re currently standing in