Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Feb 2012 17:07:32 -0500
From:      Andre Goree <andre@drenet.info>
To:        =?KOI8-R?B?68/O2MvP1yDl18fFzsnK?= <kes-kes@yandex.ru>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: 'rm' Can not delete files
Message-ID:  <CAN-pd=d_B0NpQyyP0HEkMcYyBHb04YEJr%2BtWMyL1y=sK8Ed32g@mail.gmail.com>
In-Reply-To: <1237723287.20120207235924@yandex.ru>
References:  <1237723287.20120207235924@yandex.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
2012/2/7 =EB=CF=CE=D8=CB=CF=D7 =E5=D7=C7=C5=CE=C9=CA <kes-kes@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN-pd=d_B0NpQyyP0HEkMcYyBHb04YEJr%2BtWMyL1y=sK8Ed32g>