Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Feb 2000 18:20:45 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        John <papalia@udel.edu>
Cc:        darryl@osborne-ind.com, freebsd-questions@FreeBSD.ORG
Subject:   Re: OFF TOPIC - Shell Script Question
Message-ID:  <20000209182045.B82869@hades.hell.gr>
In-Reply-To: <4.1.20000208154025.009f3bb0@mail.udel.edu>; from papalia@udel.edu on Tue, Feb 08, 2000 at 03:42:31PM -0500
References:  <001101bf7273$e44dc250$070101c0@ruraltel.net> <4.1.20000208154025.009f3bb0@mail.udel.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 08, 2000 at 03:42:31PM -0500, John wrote:
> >I have a directory with a ton of files in it.  I need to move some of
> >them to another
> >directory.  Here's what I'm thinking:
> >
> >ls -tl | grep '1999' | awk '{print "mv " $9 " /home/darryl/test"}'
> 
> I'm thinking that there has to be some way to do this with find maybe?  I
> just reviewed the man pages and didn't find the option I was looking for,
> but maybe some modification on the line:
> 
> find . -newer "your.oldest.1999.file.here" -ok mv {} /home/darryl/test \;
> 
> Gotta be a better way, but I thought I'd throw that up as food for thought?

Actually, this is a pretty nice thing.  I really liked the -ok use
instead of the usual -exec :)

If you're sure that the files are all those that match '*1999*' though,
you could easily get away with:

    % find . -type f -name '*1999*' -exec mv '{}' /home/darryl/test \;

-- 
Giorgos Keramidas, < keramida @ ceid . upatras . gr >
For my public PGP key: finger keramida@diogenis.ceid.upatras.gr
PGP fingerprint, phone and address in the headers of this message.


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?20000209182045.B82869>