Command to Remove Many Files from a Directory on Linux

Categories: Linux · Automation and scripts

Translated from Portuguese. Read the original

Hi everyone,

Here’s a quick tip for when you want to remove many files (usually millions of files) from a directory on Linux.

By default you won’t be able to do this using “rm -rf *”; Linux will return a message saying that the argument list is too long.

To do it you can adapt the command below to your scenario:

find /u01/app/11.2.0/grid/rdbms/audit/ -name '+ASM*.aud' -type f -mtime +15 -print -delete

I’m going to keep writing some shorter articles to keep the blog up to date and also to serve as a repository for my own use.

Cheers,

Franky

Comments