Hello,
I am gettig belwo error while deleting files:
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/*.aud -mtime +60 -exec rm{}\;
ksh: /usr/bin/find: arg list too long
Please assist.
Best regards,
Vishal
Hello,
I am gettig belwo error while deleting files:
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/*.aud -mtime +60 -exec rm{}\;
ksh: /usr/bin/find: arg list too long
Please assist.
Best regards,
Vishal
Try
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/*.aud -mtime +60 | xargs -l rm
--ahamed
This is also giving the same error
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/*.aud -mtime +60 | xargs -l -I {} rm {}
ksh: /usr/bin/find: arg list too long
Best regards,
Vishal
I guess you need to modify the find command then, try this
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/ -name "*.aud" -type f -mtime +60 -delete
--ahamed
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/ -name "*.aud" -type f -mtime +60 -delete
find: bad option -delete
This is AIX os.
Best regards,
Vishal
Use the -exec option then
find /prodoragridcn_01/app/oracle/product/10204/rdbms/audit/ -name "*.aud" -type f -mtime +60 -exec rm {} \;
--ahamed
Vishal_dba,
The problem here is that the shell is expanding your command before executing, so if it's going to match one file, it's probably fine. Matching 20 will be a problem as you will actually execute:-
find file1 file2 file3 file4............file20 -type f -mtime +60 -exec rm {} \;
Of course, you might match 5000 files. This is why giving the directory name only as the first parameter to find and using the -name "*.aud"
arguments will be far better. This tels it to search from one location and match files (directories, pipes, etc.) based on your expression. That actual command executed is as seen, without expansion. Remember to keep *.aud
quoted.
I hope that this explanation helps show why ahamed101 has a good solution.
Robin