argument list too long

"Argument list too long" from rm, cp or mv: too many files for one command line. Hand them over in batches.

filesshell

danger Steps marked danger delete, overwrite or stop something. Read each one before you run it.

steps
  1. find . -maxdepth 1 -name '*.log' -delete

    danger delete them without listing them on the command line

  2. find . -maxdepth 1 -name '*.jpg' -exec mv -t /dest/ {} +

    move them, many at a time (GNU mv)

  3. printf '%s\0' *.log | xargs -0 rm

    xargs makes batches that fit

  4. getconf ARG_MAX

    how long a command line can be here

commands used

findxargsgetconf

Each has a page in lore: lore find opens it.