From owner-freebsd-questions Fri Mar 8 10:37: 0 2002 Delivered-To: freebsd-questions@freebsd.org Received: from sdsl-216-36-101-146.dsl.chi.megapath.net (sdsl-216-36-101-146.dsl.chi.megapath.net [216.36.101.146]) by hub.freebsd.org (Postfix) with SMTP id 1BE9337B400 for ; Fri, 8 Mar 2002 10:36:53 -0800 (PST) Received: (qmail 51093 invoked from network); 8 Mar 2002 18:37:12 -0000 Received: from apu.five.sight (HELO apu.five.sight.fivesight.com) (192.168.0.102) by wiggum.five.sight with SMTP; 8 Mar 2002 18:37:12 -0000 From: Lucas Bergman MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15497.1240.26783.677851@apu.five.sight> Date: Fri, 8 Mar 2002 12:37:12 -0600 To: "Jon Larssen" Cc: questions@freebsd.org Subject: Re: find(1) usage In-Reply-To: References: X-Mailer: VM 7.00 under 21.4 (patch 5) "Civil Service" XEmacs Lucid Reply-To: lucas@fivesight.com Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > I have a backup directory of some important system files, for > instance, backup/etc/master.passwd, backup/etc/groups, etc. Now, if > I'm standing just on backup's parent, I can find the files I need to > backup, like: > > find backup/ -name "*" ! -type d -print > > and the result would be > > backup/etc/master.passwd > backup/etc/groups > etc. > > Now, I'd like to use the -exec expression of find(1) to obtain the > following (sample) command: > > cp -p /etc/master.passwd backup/etc/master.passwd In a Bourne shell clone, you can do $ find backup/ [options] -print | while read f; do cp -p `echo "$f" | sed s,^backup,,` "$f" done Good luck, Lucas To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message