Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempting to delete all .AUD files - no luck!

Status
Not open for further replies.

MCubitt

Programmer
Mar 14, 2002
1,081
GB
Hello,

Why is everything so much more difficult than it need be in UNIX?!

I wanted to delete all *.aud files in the path /oracle/app/oracle/product/9.2.0.1.0/rdbms/audit/

So, as root and from root I typed:
rm /oracle/app/oracle/product/9.2.0.1.0/rdbms/audit/*.aud

but received
0403-027 the parameter list is too long

Searching the 'Net I discovered this was a common problem with (some?) shells.

The suggestion seems to be to find then rm.

Running this:
find /oracle/app/oracle/product/9.2.0.1.0/rdbms/audit/ -type f -name "*.aud" -mtime +7 -exec rm {} \;

Did nothing, yet if I removed the -exec there were no problems listing them. Oh, I added mtime since find gives me that option.

Anyway, just tried teh original rm again and it worked (did it do so many before giving up?!!!)

Are my original and secondary attempts erroneous or what?! Is there a definitive way to tidy up audit (and trace) files?!

Thanks in advance.


 
You can also use a script instead. The problem is the files number you want to delete is up to the rm limit.

I had the same problem and solve it with a script like:

for i in `ls -a /tmp/*.aud`
do
rm $i
done


For your find & rm command, did you redirect STDOUT in a log file or someting like that ?

 
eh maybe they are all newer than seven days old? syntax looks fine to me.

IBM Certified -- AIX 4.3 Obfuscation
 
In the spirit of having multiple ways of doing it...

ls /oracle/app/oracle/product/9.2.0.1.0/rdbms/audit | grep "\.aud$" | xargs rm

backslash the . to literalize it to grep (otherwise it matches any single character). $ to match end of line, which should be the normal mode of output from ls as given.

(I suspect that Gloups' suggestion will fail due to the * expansion pulling the same stunt as it did for the original attempt).
 
Thanks all for your suggestions. Chap11, I'll go with your suggestion me thinks. Ta very much.


There's no need for sarcastic replies, we've not all been this sad for that long!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top