Date: Thu, 05 Feb 2009 19:32:36 -0600 From: Paul Procacci <pprocacci@datapipe.com> To: Chris Whitehouse <cwhiteh@onetel.com> Cc: freebsd-questions@freebsd.org, t-u-t <marshc187@gmail.com> Subject: Re: shell commands - exclusion Message-ID: <498B9334.8090004@datapipe.com> In-Reply-To: <498B8A7F.2060906@onetel.com> References: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> <ae4324ed0902041905p4497c155u5d474533bbd5151f@mail.gmail.com> <498B8A7F.2060906@onetel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Chris Whitehouse wrote: > Jaime wrote: >> On Wed, Feb 4, 2009 at 9:35 AM, t-u-t <marshc187@gmail.com> wrote: >> if i have say one (or even two) single file/directories among many >> others, >> and i want to perform any said function like cp, mv, rm, etc.. , to all >> other files except that one or two, is there a way to do that in a >> single >> command? >> e.g >> rm -r * {-except foo1 foo15} > > I think you should be able to do it with a combination of -prune and > -delete (or -exec rm -rf {} \; ) on a find command. Substitute your > other commands for rm -rf in the -exec above. > > I would give you a working example except I can't figure out the > syntax for -prune. Examples from google don't seem to work in (my) > FreeBSD. > > chrisw@pcbsd% find . > .. > ../test.mov > ../test.mpg > ../dir1 > ../dir1/file1 > ../dir1/file2 > ../file3 > chrisw@pcbsd% find . -print > .. > ../test.mov > ../test.mpg > ../dir1 > ../dir1/file1 > ../dir1/file2 > ../file3 > chrisw@pcbsd% find . -print -o -prune dir1 > find: dir1: unknown option > chrisw@pcbsd% find . -print -o -prune -name dir1 > .. > ../test.mov > ../test.mpg > ../dir1 > ../dir1/file1 > ../dir1/file2 > ../file3 > chrisw@pcbsd% find . -print -o -name dir1 -prune > .. > ../test.mov > ../test.mpg > ../dir1 > ../dir1/file1 > ../dir1/file2 > ../file3 > chrisw@pcbsd% find . -o -name dir1 -prune > find: -o: no expression before -o > chrisw@pcbsd% find . -name "*" -o -name dir1 -prune > .. > ../test.mov > ../test.mpg > ../dir1 > ../dir1/file1 > ../dir1/file2 > ../file3 > chrisw@pcbsd% > > (Please don't tell me to read the man page, I have several times. Even > Aeleen Frisch says it is impenetrable :P) > > Chris > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" find . \! -name blah -a \! -name blah2 -delete no?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?498B9334.8090004>