Problem deleting files

Kurt Buff kurt.buff at
Sun Jul 1 19:54:04 UTC 2018

On Sun, Jul 1, 2018 at 12:13 PM, Paul Schmehl <paul.schmehl at> wrote:
> I have a problem with a directory full of files that I can't seem to delete.
> rm * returns argument list too long. So does file *
> find . -type f -exec rm [] \; returns rm: []: No such file or directory over
> and over again.
> ls | wc -l shows there's files there.
> ls | wc -l
> 5023368
> And ls -l actually lists the files:
> -rw-------  1 root  wheel    134 Jun  7  2015
> sess_19n679i71prvju8nuqsvd727o4
> If I try to delete that specific filename, it seems to work. (Running rm
> twice returns no such file the second time.) Yet the file count remains the
> same.
> I also tried rm -fr | ls -l | awk '{print $9}', which returned a list of
> filenames but didn't delete any of them.
> Nothing I've tried to delete these files seems to work. What can I do to get
> rid of these files?
> Paul Schmehl
> Independent Researcher

That the file count remains the same even after deleting a file seems
a bit suspicious. I'm not sure what to make of that.

But, perhaps a piecemeal approach? Assuming the files all begin
"sess_", perhaps start with 'rm sess_0*', then 'rm sess_1*', etc.

Tedious to be sure, and you might have to combine that approach with
the 'find' incantation you've also tried, but seems worth a try.

Even more tedious, but also worth trying: 'ls /directory >
/root/out.txt' and then loop through that file with rm.


More information about the freebsd-questions mailing list