find -size -1M Deletes Only the Empty File: Unit Pitfalls in a Clip Cleanup Script
A cleanup script meant to remove broken stub files from a camera recorder using find -size -1M was tested against six files of exact byte sizes. Only the empty file was selected, while a 500-byte stub survived, showing that the -1M test does not work as the author expected. The tester also found that ls -lh and ls --si print the same unit letter for different scales, one based on 1024 and the other on 1000. Both tools round sizes up, so displayed values are ceilings rather than exact figures. The author concludes that scripts copying displayed sizes into thresholds inherit these rounding and unit ambiguities, and offers safer alternatives.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in