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

[SOLVED] Re: use find to generate print list



On Sat, Jan 25, 2020 at 09:23:12AM +0100, tomas@tuxteam.de wrote:
On Sat, Jan 25, 2020 at 07:43:40AM +0000, Russell L. Harris wrote:
In the "find" man page is an example which uses (1) "-prune" to
exclude a directory and (2) "! -name '*~'" to exclude both files and
directories the name of which end in "~":

  find . -name .snapshot -prune -o \( \! -name '*~' -print0 \)|
     cpio -pmd0 /dest-dir

I have tried without success to alter the command so as to prune two
directories (".git" and "projectlog")

 find . -name .git -prune -o -name projectlog -prune -o <your-stuff-here>

should work.

I thank you; that does indeed work.  My error was the failure to
include "-name" in each subsequent OR clause.

When I add all of my stuff, I have:

find ../ -name .git -prune -o -name projectlog -prune -o
 \! -name '*~' -execdir cat {} +

In accordance with the recommendations of the find man page, I am
running the command from a subdirectory, using execdir rather than
exec, in order to guard against a race condition.

Inasmuch as this invocation of find runs properly with cat, I expect
it to run properly with enscript.

RLH




Reply to: