'rm' Can not delete files

Andre Goree andre at drenet.info
Tue Feb 7 22:34:50 UTC 2012


2012/2/7 Коньков Евгений <kes-kes at yandex.ru>

> # rm *
> /bin/rm: Argument list too long.
>
>
> in this directory about 25000 files,
> but actually there is only one argument to rm it is '*' sign.
>
> Why rm get list of all files in directore instead of deleting one by one?
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>


The 'rm' command lists each file in the directory prior to removing it.
 For very large directories, the proper (and faster in other cases) way is
to user 'find', such as below:

#  find . -delete

or, if you only want to delete files (leaving the directories):

# find . -type f -delete


More information about the freebsd-questions mailing list