Find the answer to your Linux question:
Results 1 to 2 of 2
Hello friends, I am trying to implement retention of two days in a directory in Linux box. I have implemented below code to achieve. This code works fine in AIX, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    1

    Command not working "find * -name "*exp.log" -mtime +2 -exec rm {} \;"


    Hello friends,

    I am trying to implement retention of two days in a directory in Linux box. I have implemented below code to achieve. This code works fine in AIX, however the same code does not work on Linux OS. Can somebody let me know here I am going wrong:

    find * -name "*exp.log" -mtime +2 -exec rm {} \;

    find /backups/oradata/${ORACLE_SID}/LEN_DP_DIR/* -name '*exp.log' -mtime +2 -exec rm {} \;

    Would appreciate your response.

    Thanks

  2. #2
    Just Joined!
    Join Date
    Aug 2010
    Posts
    18
    It would be better to use -delete instead of exec rm {}.

    Code:
    find /backups/oradata/${ORACLE_SID}/LEN_DP_DIR/*  -mtime +2 -name "*.log" -delete
    Use -print to check.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •