[CLUE-Tech] finding, sorting and moving selected files via the command line

Jed S. Baer thag at frii.com
Fri May 24 18:58:50 MDT 2002


On Fri, 24 May 2002 18:37:26 -0600
Kevin Cullis <kevincu at orci.com> wrote:

> Hi all,
> 
> I've come up with something that I can't seem to find an answer for. I'd
> like to move some files from one directory to another based on my
> criteria: such as files older than 2 months or files that begin with "A"
> or files that are larger than 5k, or any combination of criteria.  Is
> this possible?

Hi Kevin.

Well, I'll be a little help I hope.

find {path} {criteria} | awk '{
print "mv " $1 " {destination path}' | sh

Sometimes, I use "mv -i " instead, but then piping it directly to sh
causes the next filename to be the answer to the "overwrite" prompt, if it
occurs. Sending the output to a temp file, i.e. " > foo", and then
sourcing that file works pretty well.

The piece I wish I could to better is specifying criteria for the find
command. It's one those man pages that no matter how many times I read it,
I just don't quite grok some of the options, especially the
changed/accessed time settings. I actually spent a lot of time one day
experimenting with these, and never could get "-ctime" to get me a useful
list, or -mtime either. You'd think it would be easy, and I'm certain it
must be. Size is easier.

jed

-- 
Got Privacy? http://makeashorterlink.com/?N33052F1

"Those who expect to reap the blessings of freedom must, like men,
 undergo the fatigue of supporting it." - Thomas Paine

Received: from sccrmhc03.attbi.com (sccrmhc03.attbi.com [204.127.202.63])
	by clue.denver.co.us (8.9.3/8.9.3) with ESMTP id OAA17942
	for <clue-tech at clue.denver.co.us>; Fri, 24 May 2002 14:13:52 -0600
Received: from system2 ([12.253.241.137]) by sccrmhc03.attbi.com
          (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP
          id <20020524201600.NNTY20219.sccrmhc03.attbi.com at system2>
          for <clue-tech at clue.denver.co.us>;
          Fri, 24 May 2002 20:16:00 +0000
Date: Fri, 24 May 2002 14:17:09 -0600 (MDT)
From: Tim Harris <timdharris at attbi.com>
X-X-Sender: timh at system2.alishe2.com
To: clue-tech at clue.denver.co.us
Subject: Re: Replys with broken HTML see [Re: [CLUE-Tech] Re: "Hmm... I I
 disagree."]
In-Reply-To: <200205241953.g4OJr6LV084881 at deimos.frii.net>
Message-ID: <Pine.LNX.4.44.0205241412460.3359-100000 at system2.alishe2.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: clue-tech-admin at clue.denver.co.us
Errors-To: clue-tech-admin at clue.denver.co.us
X-BeenThere: clue-tech at clue.denver.co.us
X-Mailman-Version: 2.0beta2
Precedence: bulk
Reply-To: clue-tech at clue.denver.co.us
List-Id: CLUE technical discussions, questions and answers. <clue-tech.clue.denver.co.us>

On Fri, 24 May 2002, Jed S. Baer wrote:

> On Fri, 24 May 2002 10:58:07 -0600
> Tim Harris <tdharris at usa.com> wrote:
> 
> > Jed S. Baer wrote:
> > 
> > >"Tim Harris" <tdharris at usa.com> wrote:
> > >
> > >>Just a comment. I find it annoying to scroll through a post and see a
> > >>lot of non-functional html code. It's a pain. Does any else have an
> > >>opinion about this?
> > >
> > I'm not opposed to the rich text format but it seems to get all screw up
> > when it's sent to a discussion list. I select plain text only when I 
> > send email to lists such as this. I'm using Netscape 6.2. I suppose I 
> > could use something like fetchmail or pine but I'm too lazy to take the 
> > 5 minutes to configure it. Frankly, I occasionally need to look at and 
> > print html formatted email (invoices and the like). I suppose I'm in 
> > danger of turning this into a discussion list so I will stop.
> 
> There are certainly occassions when sending an RTF, PDF, whatever, using
> e-mail as the transport mechanism, is really fine. When you have an
> arrangement with some other party, and are expecting particular documents
> to come through as such, hey it's great to be able to use
> mime-encapsulation to send such things.
> 
> As with so many other things I rant about, the question is whether it's
> _necessary_, i.e. is there something essential conveyed by using other
> than plain text, or is it just fluff. And, in the case of e-mail, there
> are plenty of people using older software (or software which just takes
> the [IMHO correct] stand of "e-mail is plain text and should stay that
> way") who will have trouble reading it. Note that I'm not saying that some
> particular document should not be sent as an attachment as HTML, but
> that's a different thing. The main body should just be plain text (in
> whatever language you use).
> 
> Just curious whether Nutscape's new e-mail program still interprets and
> executes all HTML tags in a e-mailed document. I can remember a while back
> getting spams with <IMG> tags in them, and I was initially shocked when my
> _mail_ program actually behaved just like a web browser, and retrieved the
> poxy things.
> 
> My personal recommendation is Sylpheed. It's really a snap to set up and
> run. It strips HTML and shows you the plain text. It's fast. Hey, it'll
> even auto-sort your mail into various folders, if you like.
> 
> Since this is a discussion list, I don't see any harm in having the
> discussion ;-).
> 
> jed
> 
Jed, Your a voice of reason. You got me curious. I think I'll give 
Sylpheed a shot and see how I like it.

Tim


Received: from maple.phpwebhosting.com (maple.phpwebhosting.com [66.33.60.223])
	by clue.denver.co.us (8.9.3/8.9.3) with SMTP id NAA07597
	for <clue-tech at clue.denver.co.us>; Wed, 22 May 2002 13:05:04 -0600
Received: (qmail 28090 invoked by uid 508); 22 May 2002 19:07:13 -0000
Received: from unknown (HELO dissociatedpress.net) (12.253.234.254)
  by maple.phpwebhosting.com with SMTP; 22 May 2002 19:07:13 -0000
Message-ID: <3CEBCEB6.1040709 at dissociatedpress.net>
Date: Wed, 22 May 2002 13:00:38 -0400
From: "Joe 'Zonker' Brockmeier" <jzb at dissociatedpress.net>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020510
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: clue-tech at clue.denver.co.us
Subject: Re: [CLUE-Tech] Directory permissions -- problems with "-w--w--w-"
References: <3CEBB303.5010103 at pcisys.net>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Sender: clue-tech-admin at clue.denver.co.us
Errors-To: clue-tech-admin at clue.denver.co.us
X-BeenThere: clue-tech at clue.denver.co.us
X-Mailman-Version: 2.0beta2
Precedence: bulk
Reply-To: clue-tech at clue.denver.co.us
List-Id: CLUE technical discussions, questions and answers. <clue-tech.clue.denver.co.us>

bof wrote:


> But when I changed the directory permissions to -w--w--w-,  I could not 
> add a new file or delete any of the existing files, getting a 
> "permission denied" message. This is not as I understand it: I should be 
> able to do this.

As I understand it, this is because a utility cannot write a file to a 
directory unless it can "see" (r) the files in the directory and the 
same goes for deleting a file. For example, rm returns an error if you 
try to remove a file that does not exist. The first thing it does 
(AFAIK) is to "look" to see if the file in fact exists before attempting 
to remove it, then checks the permissions before trying to remove it and 
finally, it will actually remove it if test 1 and test 2 have passed. If 
file does not exist, error. If file exists but you do not have 
sufficient permissions, error. It must read the file before it can 
decide this, though. I imagine that most of the other GNU utilies 
perform the same checks.

Take care,

Zonker
-- 
Joe 'Zonker' Brockmeier -=- jbrockmeier at earthlink.net
http://www.DissociatedPress.net/
ymessenger: jbrockmeier / AIM: ZonkerJoe
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Your mother dresses you funny and you need a mouse to delete files.




More information about the clue-tech mailing list