Skip to content

www.rolfje.com

Parameter List Too Long

Posted on 2007-04-17 By rolfje 1 Comment on Parameter List Too Long

If your are “fortunate” enough to have to delete a lot of file from a directory on a Unix system, you are likely to encounter the “Parameter List Too Long” problem. This problem is caused by Unix trying to replace the “*” you just used by all names in the directory. This list is then passed to the rm command, which complains that it can not handle that much parameters.

To get around this limitation, you have a couple of options:

Delete all files in the current directory
By far the fastest and most compatible way to delete all files in the current directory without recursing into subdirectories is:
ls | xargs rm
This is the fastest command, because xargs makes sure the maximum allowed number of parameters is passed to rm, resulting in fewer calls/startups to rm.

Delete all files in the current directory and all subdirectories
To delete files not only from the current, but also from all subdirectories, use
find . -name "*" -exec rm -rf {} \;
This is somewhat slower, since rm is executed seperately for each file.

Above commands are tested on AIX and Linux.

Software Tags:programming, unix

Post navigation

Previous Post: Thoughts on Widgets, Gadgets, Screenlets
Next Post: Disabling the Windows Clipboard

Comment (1) on “Parameter List Too Long”

  1. rolfje says:
    2007-10-10 at 01:12

    Original reply by Sybren:

    That last command doesn’t only remove files from the current dir and subdirs, it also deletes the subdirs themselves. Just be warned 😉

    If you want to remove files only and leave the subdirectories in place, use:
    find . -type f -exec rm {} \;

    None of those commands work when you have files with spaces in them. In that case, use the “-print0” option of find combined with the “-0” option of xargs. I haven’t tested this on AIX though, only on GNU find/xargs as shipped with most Linux distributions.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

         
@rolfje.com
www.youtube.com/watch?v=_ZBK...
3 hours ago
@rolfje.com
www.youtube.com/watch?v=anwK...
2 days ago
Reposted by @rolfje.com
@michaelspicer.bsky.social
What if James Bond had to do a few days in the office. Short film below.

youtu.be/hhd0hOIDljA
2 days ago

Recent Comments

  • rolfje on Spring SystemPropertyInitializingBean
  • plinko idle clicker on Spring SystemPropertyInitializingBean
  • rolfje on The podcast problem (fixed)
  • SirenMix on The podcast problem (fixed)
  • egorio on Volkswagen e-Up! 80% charge trick

Tags

Anonimatron Apple backup design DIY DRM eclipse environment fix Fun gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Kawasaki Keynote linux modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software technology Time Machine Ubuntu usability Utilities vacation windows Workshop

Categories

  • Apple (107)
  • Divorce (1)
  • Electronics (5)
  • Fun (58)
  • Games (8)
  • Hardware (74)
  • Microsoft (18)
  • Racing (16)
  • Software (144)
  • Uncategorized (69)
  • Workshop (23)

Archives

Brought to you without adds, banners, cookies or tracking. This one is on me. Yes, life can be this good. Pay it forward.
AI policy - Privacy policy

Copyright © 2026 www.rolfje.com.

Powered by PressBook WordPress theme