[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: how to exclude a directory from find?



Lazaro Salem <salem@rf.no> wrote:

>The -print flag is not really needed as is executed by default.

This isn't true of all systems. If you want portability, include the
-print.

>Certainly it would be nice to have something like:
> $ find . -type !d  
> to match files which are not directories, but I don't know if something 
> like that is possible for find. So if can take your question and rephrase 
> it: 
> 
> Is there any kind of "logical not" affecting a flag in find? 

Yes, ! is it. find uses shell-style evaluation, so for the above you
would say:

    find . ! -type d -print

Casper Boden-Cummins.



Reply to: