3 ms·
> exactly half the files in a directory What if there are an odd number of files, does it delete half a file then?
by 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).