Wednesday, May 24, 2017

Deleting tons of files in Linux (Argument list too long)

option 1
find /oramisc01/oracle/demo/adump -name "*aud"  -type f -mtime +1 -exec rm {} \;

option 2
find  /oramisc01/oracle/demo/adump  -name "aud*" -type f  -delete

option 3
find  /oramisc01/oracle/demo/adump  -name "aud*" -type f -mtime +1 |xargs rm -rf

option 4
mkdir empty_dir
rsync -a -delete empty_dir/ yourdirectory/


option 5
perl -e 'for(<*aud>){((stat)[9]<(unlink))}'