What command to find files that not meeting some conditions?

Discussion in 'Site & Server Administration' started by KennyP, Feb 12, 2009.

  1. #1
    Usually, when we look for a file named, "abc.gz", the command will be:

    find -name "abc.gz"

    But how to find all files which is not named as "abc.gz"?
     
    KennyP, Feb 12, 2009 IP
  2. sparek

    sparek Peon

    Messages:
    68
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use the -not parameter:

    find -not -name 'abc.gz' -print
    Code (markup):
    if you are only interested in files, then you'll probably have to pass file as the type to return:

    find -not -name 'abc.gz' -type f -print
    Code (markup):
     
    sparek, Feb 12, 2009 IP
  3. KennyP

    KennyP Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It works great, thank you so much :D
     
    KennyP, Feb 13, 2009 IP