There are over 1m+ cache files in one directory on a server. I would need to remove them, but of course rm first lists file and then starts to remove them.That cause a high spike in a server CPU load and can cause whole server to break down.Any ideas how to safely remove them without causing any harm?
Remove a lot of cache files
linux;rm;cache
If you value more cpu usage than speed on the erase, this is a good approach:find <dir> -type f -exec ionice -c3 rm {} \;Replace \; with + if you want some more speed (and more cpu).