Sunday, May 29, 2022

How to delete old file using find command on AIX operating system

Delete log files on AIX operating system which are older than 365 days.

Command to list these files
#find /oracle/log -name "*.log" -mtime +365 -exec ls -lrt {} \;

#find /oracle/log -name "*.txt" -mtime +365 -exec ls -lrt {} \;

Above command will list which are older than 365 days.

If UNIX AIX admin wanted to remove them after approval from Oracle team he can remove by following command

#find /oracle/log -name "*.log" -mtime +365 -exec rm {} \;

find /oracle/log -name "*.txt" -mtime +365 -exec rm {} \;

Same command AIX admin can use different criteria like 100 days, 200 days old file housekeeping,by modifying -mtime .

Thanks.

No comments:

Post a Comment