1

I have a directory in my webserver that has 116 thousand cookie files in it.

How do I delete them?

rm -r /var/www/html/secured/cookies/*

I tried this but it does not work.

-bash: /bin/rm/: Argument list too long

That is the error given.

Ollie
  • 13
  • ls -f | xargs rm will be faster than find. The -f option disables the sort (shell globbing always sorts; ls usually does) – mpez0 Jan 04 '15 at 01:42

3 Answers3

3

find /var/www/html/secured/cookies -type f -delete

Or something with xargs, but I prefer the find command..

1

Using perl?

perl -e 'for(</var/www/html/secured/cookies/*>){unlink}'
kale20
  • 157
1

Unless you have hidden (dot) files you want to save, just remove the whole folder

rm -r /var/www/html/secured/cookies

Then, if needed, recreate it

mkdir /var/www/html/secured/cookies
Kevin
  • 338
  • 2
  • 13