Find the answer to your Linux question:
Results 1 to 3 of 3
I'm trying to find all the files in a specified directory that do NOT end in .archived or .error and are older than 30 mins. Currently I have: Code: find ...
  1. #1
    Just Joined!
    Join Date
    Apr 2005
    Posts
    14

    find syntax, exclude certain extensions and filter by age

    I'm trying to find all the files in a specified directory that do NOT end in .archived or .error and are older than 30 mins. Currently I have:
    Code:
    find /opt/edi/incoming -type f \! \( -name "*.archived" -name "*.error" \) -cmin 30
    But I keep returning files that end in those extensions and I'm not sure if I'm using -cmin correctly??? Any help?

    If there is a better way to do this (perl, etc) I'm open to options, this is for a nagios check.

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Try this:

    Code:
    find /opt/edi/incoming -type f \( ! -name "*.archived" -a ! -name "*.error" \) -cmin +30

  3. #3
    Just Joined!
    Join Date
    Apr 2005
    Posts
    14
    That works perfect, thanks!

Posting Permissions

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