Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 May 2000 01:26:36 -0400 (EDT)
From:      Trevor Johnson <trevor@jpj.net>
To:        Darren Wyn Rees <merlin@netlink.co.uk>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: "rm -rf *" - "argument list too long"
Message-ID:  <Pine.BSI.4.21.0005130121520.23048-100000@blues.jpj.net>
In-Reply-To: <20000507201410.M540@netlink.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
> I'm in a directory with a tonne of files I wish to delete.
> I type "rm -rf *", but it won't work, it gives "/bin/rm: Argument
> list too long".  So how can I delete these many files ?
> 
> I can "cd ..", and then "rm -rf <directory name>", and that works.
> 
> However, what if I didn't wish to remove directories.  In that
> case, what would I do to remove the files ?

This will recursively remove just the plain files, leaving behind
directories, symlinks, pipes, and device files:

	find <directory name> -type f -exec rm \{\} \;

With your shell, you might not have to use as many escapes.
--
Trevor Johnson
http://jpj.net/~trevor/gpgkey.txt



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.4.21.0005130121520.23048-100000>