Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, I am trying to find all files older than 15 days with extensions other than gz, for some reason the find I have does not have regextype switch, ...
  1. #1
    Just Joined!
    Join Date
    Nov 2008
    Posts
    11

    [SOLVED] find regex

    Hi all,

    I am trying to find all files older than 15 days with extensions other than gz, for some reason the find I have does not have regextype switch, please advise regex that will do it

    Code:
    find . -type f -regex .*.^gz -mtime +15
    obviously did not work as by default find uses emacs regexes which use ^ for beginning of line. Your help much appreciated!

    SuSE Linux, 2.6.5-7.312

  2. #2
    Linux Newbie
    Join Date
    Jul 2008
    Posts
    181
    I don't quite see what your regular expression is supposed to match, and you should definitely use quotes as well. I assume you are looking for files that do not have the "extension" ".gz". In that case, you don't even need regular expressions. A simple
    Code:
    -not -name "*.gz"
    will do.

  3. #3
    Just Joined!
    Join Date
    Nov 2008
    Posts
    11
    Thanks very much, it worked! Quoted the name in the script, thanks for the hint.

Posting Permissions

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