News for hackers. Stuff that matters.
Re:The growth of command-line options, 1979-Present by loeg on Tuesday March 03, 2020 @06:43PM (#22479854)
By size:

  python -c 'import os; \
    os.write(1, b"\0".join( \
      sorted(os.listdir(b"."), key=lambda p: os.stat(p).st_size)))' \
  | xargs -0 ...
By date: swap st_size for st_mtime.

(Python3 does try to make this hard on us — Unix path names are just bags of bytes, but Python insists that printing must have some known encoding. I get around that by abusing os.write(1, ...) and by adding the dummy b"." argument to os.listdir(), which forces the results to be in bytes format.)

There are no comments on this comment yet.