Replace find with locate

Discussion in 'Programming/Scripts' started by wildgoosed, Jul 26, 2007.

  1. wildgoosed

    wildgoosed New Member

    Hey everyone, I have a script that uses find to find all files within some sub-dirs and sets a extended acl on those files it finds.

    Find is somewhat slow and this script is taking longer then I would like, so I would like to somehow replace the following shell command with locate if possible...

    Code:
    find /usr/file_manager_2007/ -type f -prune -exec setfacl -m g:directors:rwx {} \;
    Can anyone help... ?

    Thanks.
     
    Last edited: Jul 26, 2007
  2. sjau

    sjau Local Meanie Moderator

    Have a look at the exec(); function.
     
  3. wildgoosed

    wildgoosed New Member

    I'm sorry I don't understand,

    Do you mean something is incorrect about my syntax?
     
  4. cfajohnson

    cfajohnson New Member

    It might not be any faster, but try this:

    Code:
    locate '/usr/file_manager_2007/*' |
     while read file
     do
        [ -f "$file" ] && setfacl -m g:directors:rwx "$file"
     done
    
    
     

Share This Page