I accumulate sequentially named files as the result of an automated process, and I would like to keep only the last 10 around. I tried this, which had the effect of deleting everything:
ls -r | more +11 | xargs rm
Apparently piping more +n
causes the entire result to be piped, without regard to the +n
argument.
What would be the correct approach?