-bash: /bin/rm: Argument list too long wile removing files

Problem:

I have a directoy in linux that has several hundred thousand files, and is about 8.2 Gb. I attempted to clear out the directory using ‘rm -rf *aud’, and got the following error:

Oracle audit files:

[oracle@drexa01dbadm01 rdbms]$ du -sh audit
8.2G audit
[oracle@drexa01dbadm01 rdbms]$ cd audit/
[oracle@drexa01dbadm01 audit]$pwd
/u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/audit
[oracle@drexa01dbadm01 audit]$ rm -rf *aud
-bash: /bin/rm: Argument list too long
[oracle@drexa01dbadm01 audit]$

Solution:

[root@drexa01dbadm01 audit]# find . -name '*aud' | xargs rm -v
removed `./opum_ora_5570_20170419113001272611143795.aud'
removed `./opum_ora_19087_20170825213720316402143795.aud'
removed `./opum_ora_24477_20170215033002283227143795.aud'
removed `./opum_ora_7691_20160815080001986930143795.aud'
removed `./opum_ora_16653_20160907043002231684143795.aud'
removed `./opum_ora_13406_20170127234157760483143795.aud'
removed `./opum_ora_20966_20160830140953226189143795.aud'
removed `./opum_ora_32328_20160302052636008652143795.aud'
removed `./opum_ora_8918_20170924193849158242143795.aud'
removed `./opum_ora_3496_20160915031853572953143795.aud'
removed `./opum_ora_6372_20161020181850094006143795.aud'
removed `./opum_ora_14855_20161014233431338219143795.aud'
removed `./opum_ora_3543_20160320162656730084143795.aud'
removed `./opum_ora_507_20171004204104885761143795.aud'
removed `./opum_ora_28535_20160510060437060235143795.aud'
removed `./opum_ora_12919_20170501052812370394143795.aud'
removed `./opum_ora_19556_20161209185701631815143795.aud'
removed `./opum_ora_4558_20170821004123546569143795.aud'
removed `./opum_ora_12780_20170113235941423540143795.aud'
removed `./opum_ora_7448_20160602072824080487143795.aud'
removed `./opum_ora_25740_20160704060001516869143795.aud'
removed `./opum_ora_18222_20170211181055180098143795.aud'
removed `./opum_ora_14988_20160619075753542821143795.aud'
removed `./opum_ora_18060_20170510231755910407143795.aud'
removed `./opum_ora_4974_20160904032946872225143795.aud'
removed `./opum_ora_22492_20160810164246080476143795.aud'
removed `./opum_ora_30220_20160730184335973711143795.aud'
removed `./opum_ora_9281_20160601050646550905143795.aud'
removed `./opum_ora_23802_20161007002846100802143795.aud'
removed `./opum_ora_31124_20170722151749240758143795.aud'
removed `./opum_ora_19994_20160603044311483365143795.aud'
removed `./opum_ora_12052_20160228214028001728143795.aud'
removed `./opum_ora_15291_20170914184724665451143795.aud'
removed `./opum_ora_22103_20160603225229269785143795.aud'
removed `./opum_ora_16853_20170731031019341399143795.aud'
removed `./opum_ora_17237_20170418113002372693143795.aud'
removed `./opum_ora_6563_20161224000002747653143795.aud'
removed `./opum_ora_25523_20170623172237509923143795.aud'
removed `./opum_ora_31895_20160806180001664608143795.aud'

 

 

 

Advertisements