Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Exclamation command find -> exlude files & folders ..


    Hi everyone, I'm a begineer with linux syntax ..

    I want to search this folder, excluding "cache" & "ip" subfolders, size between 300 & 1 bytes, excluding "sess_*" session files..
    My syntax is aproximate & doesn't work on excluding these patterns ..

    find /z/tmp/ -type f \( ! -name cache -type d -prune ! -name ip -type d -prune \) -not \( -name 'sess_*' -prune \) Thanks for help

  2. #2
    Quote Originally Posted by ben74 View Post
    Hi everyone, I'm a begineer with linux syntax ..

    I want to search this folder, excluding "cache" & "ip" subfolders, size between 300 & 1 bytes, excluding "sess_*" session files..
    My syntax is aproximate & doesn't work on excluding these patterns ..

    find /z/tmp/ -type f \( ! -name cache -type d -prune ! -name ip -type d -prune \) -not \( -name 'sess_*' -prune \) Thanks for help
    I assume you are just interested in files, yes? If so, try this:
    Code:
    find . -type f -not \( -path "/cache/*" -o -path "/ip/*" \) ! -name 'sess_*' -size +1c -a -size -300c -print

  3. #3
    Quote Originally Posted by atreyu View Post
    I assume you are just interested in files, yes? If so, try this:
    Code:
    find . -type f -not \( -path "/cache/*" -o -path "/ip/*" \) ! -name 'sess_*' -size +1c -a -size -300c -print
    Well it stills, doesn't exclude those folders ... argh ...

  4. $spacer_open
    $spacer_close
  5. #4
    Quote Originally Posted by ben74 View Post
    Well it stills, doesn't exclude those folders ... argh ...
    odd, it does for me. maybe show your directory structure so we can see exactly what your working with.

Posting Permissions

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