From owner-freebsd-questions Thu Jan 2 18:30:25 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D6F0837B401 for ; Thu, 2 Jan 2003 18:30:23 -0800 (PST) Received: from sub21-156.member.dsl-only.net (sub21-156.member.dsl-only.net [63.105.21.156]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4720343ED1 for ; Thu, 2 Jan 2003 18:30:23 -0800 (PST) (envelope-from nkinkade@sub21-156.member.dsl-only.net) Received: from nkinkade by sub21-156.member.dsl-only.net with local (Exim 4.10) id 18UHbK-000H7I-00 for freebsd-questions@freebsd.org; Thu, 02 Jan 2003 18:30:22 -0800 Date: Thu, 2 Jan 2003 18:30:22 -0800 From: Nathan Kinkade To: freebsd-questions@freebsd.org Subject: Re: Shell guru needed. [Ahhhh! Sorry, but one more...] Message-ID: <20030103023022.GB65686@sub21-156.member.dsl-only.net> Reply-To: nkinkade@dsl-only.net Mail-Followup-To: freebsd-questions@freebsd.org References: <200301030103.h0313b67012698@labs.unixhideout.com> <20030103015255.GM5327@sub21-156.member.dsl-only.net> <20030103015811.GA65686@sub21-156.member.dsl-only.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030103015811.GA65686@sub21-156.member.dsl-only.net> User-Agent: Mutt/1.4i 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 On Thu, Jan 02, 2003 at 05:58:11PM -0800, Nathan Kinkade wrote: > On Thu, Jan 02, 2003 at 05:52:55PM -0800, Nathan Kinkade wrote: > > On Thu, Jan 02, 2003 at 08:03:37PM -0500, mike wrote: > > > Hey guys. heres the skinny. I have a huge library and i want to organize it. I want find to go through recursively, and move any "pdf" files it finds to a certain directory. I need an example piece of script on how i would confront this. It will save me hours if not days so thanks in advance. > > > > First, turn on line-wrapping in your MUA. > > > > find /path/to/my/libarary -name *.pdf -exec mv {} /new/dir/{} \; > > > > Nathan > > Sorry, I wasn't thinking here....after I double check the man page I saw > that -exec replaces {} with the path, not just the file name....the > above will not work...use the if;do;done syntax that someone else has > already posted. > > Thanks! > Nathan Argggg! I aplogize to reply to my own message a second time!, but something didn't sit well with me after my last reply so I double checked my syntax and found that my original command would work with two modifications -quote *.pdf and remove second {}: find /path/to/dir -name "*.pdf" -exec mv {} /new/dir \; ..that should do it, but the other suggestions are just as easy...whichever. Sorry for the wasted bandwidth! I'm done now! :) Nathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message