Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jan 2003 18:30:22 -0800
From:      Nathan Kinkade <nkinkade@dsl-only.net>
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>
In-Reply-To: <20030103015811.GA65686@sub21-156.member.dsl-only.net>
References:  <200301030103.h0313b67012698@labs.unixhideout.com> <20030103015255.GM5327@sub21-156.member.dsl-only.net> <20030103015811.GA65686@sub21-156.member.dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030103023022.GB65686>