Date: Fri, 8 Mar 2002 12:37:12 -0600 From: Lucas Bergman <lucas@fivesight.com> To: "Jon Larssen" <jonlarssen@hotmail.com> Cc: questions@freebsd.org Subject: Re: find(1) usage Message-ID: <15497.1240.26783.677851@apu.five.sight> In-Reply-To: <F169kAvjUqMUrYawLLe00013a42@hotmail.com> References: <F169kAvjUqMUrYawLLe00013a42@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15497.1240.26783.677851>