Find Command Syntax

2004-09-22 Thread Drew Tomlinson
I'm trying to write a script to feed the mail in my spam folder to 
Spamassassin's sa-learn and then delete the mails older than 1 day in 
that spam folder.  Here's my current directory listing:

blacklamb ll /path/to/Maildir/.Spam/cur
total 70
-rw---  1 user  group   6118 Sep 22 02:08 
1095844100.98444_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   3545 Sep 22 02:21 
1095844907.98477_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   7408 Sep 22 03:18 
1095848327.99825_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   6560 Sep 22 03:44 
1095849842.99908_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   5203 Sep 22 04:57 
1095854240.48102_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   3313 Sep 22 05:21 
1095855688.48172_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   5718 Sep 22 06:34 
1095860049.48407_0.blacklamb.mykitchentable.net:2,
-rw---  1 user  group   5254 Sep 22 07:22 
1095862947.48525_0.blacklamb.mykitchentable.net:2,
-rw-r--r--  1 user  group  23314 Sep 21 18:41 
1095863122.M795851P95252V5B00I0031FB22_1.blacklamb.mykitchentable.net,S=23314:2,S

I'm trying to use the find command to do the deleting but am having 
trouble with the syntax.  For testing, I'm using this command:

blacklamb find /path/to/Maildir/.Spam/cur \! -newerct 1d -print
blacklamb
It finds nothing.  I read in the manual that time specifications don't 
have much meaning without the '-' or '+' operator so I try adding it:

blacklamb find /usr/home/tomlinson_dr/Maildir/.Spam/cur \! -newerct -1d 
-print
find: Can't parse date/time: -1d
blacklamb find /usr/home/tomlinson_dr/Maildir/.Spam/cur \! -newerct +1d 
-print
find: Can't parse date/time: +1d

I've also tried a combination of adding ()'s around the expression but 
that hasn't worked either.  What am I missing?  Is this an appropriate 
choice for what I want to do?  Is there another command better suited 
for this task?

Thanks,
Drew
--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!
http://www.alchemistswarehouse.com


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Find Command Syntax

2004-09-22 Thread Kliment Andreev
Drew Tomlinson wrote:
I've also tried a combination of adding ()'s around the expression but 
that hasn't worked either.  What am I missing?  Is this an appropriate 
choice for what I want to do?  Is there another command better suited 
for this task?
Use quotes 
# find . -name aaa -print  differs from
# find . -name aaa - print
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Find Command Syntax

2004-09-22 Thread Matthew Seaman
On Wed, Sep 22, 2004 at 08:26:07AM -0700, Drew Tomlinson wrote:
 I'm trying to write a script to feed the mail in my spam folder to 
 Spamassassin's sa-learn and then delete the mails older than 1 day in 
 that spam folder.  Here's my current directory listing:

 I'm trying to use the find command to do the deleting but am having 
 trouble with the syntax.  For testing, I'm using this command:
 
 blacklamb find /path/to/Maildir/.Spam/cur \! -newerct 1d -print
 blacklamb
 
 It finds nothing.  I read in the manual that time specifications don't 
 have much meaning without the '-' or '+' operator so I try adding it:

Try:

find /path/to/Maildir/.Spam/cur -type f -mtime +1 -print

Or you might want to use -ctime instead of -mtime -- I think mtime is
probably a more reliable measure than ctime.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgpZnn7RZ9fVo.pgp
Description: PGP signature


Re: Find Command Syntax

2004-09-22 Thread Drew Tomlinson
On 9/22/2004 8:39 AM Matthew Seaman wrote:
On Wed, Sep 22, 2004 at 08:26:07AM -0700, Drew Tomlinson wrote:
 

I'm trying to write a script to feed the mail in my spam folder to 
Spamassassin's sa-learn and then delete the mails older than 1 day in 
that spam folder.  Here's my current directory listing:
   

 

I'm trying to use the find command to do the deleting but am having 
trouble with the syntax.  For testing, I'm using this command:

blacklamb find /path/to/Maildir/.Spam/cur \! -newerct 1d -print
blacklamb
It finds nothing.  I read in the manual that time specifications don't 
have much meaning without the '-' or '+' operator so I try adding it:
   

Try:
   find /path/to/Maildir/.Spam/cur -type f -mtime +1 -print
Or you might want to use -ctime instead of -mtime -- I think mtime is
probably a more reliable measure than ctime.
 

Thanks for your reply.  This seems to work.  However I'm confused.  
Should I use -ctime or -mtime?

Drew
--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!
http://www.alchemistswarehouse.com


smime.p7s
Description: S/MIME Cryptographic Signature


Re: Find Command Syntax

2004-09-22 Thread Matthew Seaman
On Wed, Sep 22, 2004 at 09:04:38AM -0700, Drew Tomlinson wrote:
 On 9/22/2004 8:39 AM Matthew Seaman wrote:

 Try:
 
find /path/to/Maildir/.Spam/cur -type f -mtime +1 -print
 
 Or you might want to use -ctime instead of -mtime -- I think mtime is
 probably a more reliable measure than ctime.

 Thanks for your reply.  This seems to work.  However I'm confused.  
 Should I use -ctime or -mtime?

Hmmm... well, if you just save the Spam messages into that directory
and don't alter them after that, then mtime and ctime will actually be
the same.  Either will do.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgp9bpfou37bh.pgp
Description: PGP signature


Re: Find Command Syntax

2004-09-22 Thread Drew Tomlinson
On 9/22/2004 10:34 AM Matthew Seaman wrote:
On Wed, Sep 22, 2004 at 09:04:38AM -0700, Drew Tomlinson wrote:
 

On 9/22/2004 8:39 AM Matthew Seaman wrote:
   

 

Try:
 find /path/to/Maildir/.Spam/cur -type f -mtime +1 -print
Or you might want to use -ctime instead of -mtime -- I think mtime is
probably a more reliable measure than ctime.
 

 

Thanks for your reply.  This seems to work.  However I'm confused.  
Should I use -ctime or -mtime?
   

Hmmm... well, if you just save the Spam messages into that directory
and don't alter them after that, then mtime and ctime will actually be
the same.  Either will do.
 

OK, I'm trying to understand the difference.  According to the manual 
-ctime is change of file status and -mtime is last modification 
time.  I think I understand what modification means (changing the 
contents of the file) but what is change of file status?  In my 
particular situation, while reviewing my spam folder for possible ham, 
my IMAP client may change the message status from unread to read.  How 
would this affect the actual message file?

Thanks again!
Drew


smime.p7s
Description: S/MIME Cryptographic Signature


RE: Find Command Syntax

2004-09-22 Thread Ralph Hempel

 OK, I'm trying to understand the difference.  According to the manual 
 -ctime is change of file status and -mtime is last modification 
 time.  I think I understand what modification means (changing the 
 contents of the file) but what is change of file status?  In my 
 particular situation, while reviewing my spam folder for possible ham, 
 my IMAP client may change the message status from unread to read.  How 
 would this affect the actual message file?

Contents change is when what's inside the file changes.

Status change is when the file descriptor status, like read-only, or
permissions changes.

Ralph
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Find Command Syntax

2004-09-22 Thread Matthew Seaman
On Wed, Sep 22, 2004 at 10:47:38AM -0700, Drew Tomlinson wrote:

 OK, I'm trying to understand the difference.  According to the manual 
 -ctime is change of file status and -mtime is last modification 
 time.  I think I understand what modification means (changing the 
 contents of the file) but what is change of file status?  In my 
 particular situation, while reviewing my spam folder for possible ham, 
 my IMAP client may change the message status from unread to read.  How 
 would this affect the actual message file?

The ctime entry (originally 'creation time') used to be intended to
record when the file was created.  Nowadays it records the last time
the inode for the file changed -- that includes such things as changes
to file permissions, ACLs, option flags etc., but not such things as
modifications to the file contents which don't change the file size a
great deal.

This status has nothing to do with what your IMAP client reports as
the file status.  The ctime concept applies to any file on the system,
no matter what it's used for.  IMAP status just records or modifies an
extra header within the message to indicate if it's been read or not.

Thus reading those messages via IMAP might change mtime but not
ctime. However, I'm not certain of that.  You'll have to experiment.
You can print out the ctime and mtime for the files by:

% stat -f 'ctime=%Sc mtime=%Sm   %N' -t '%c' *

Usually mtime and ctime will be exactly the same.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgp7LoNKysm6B.pgp
Description: PGP signature


Re: Find Command Syntax

2004-09-22 Thread Drew Tomlinson
On 9/22/2004 11:23 AM Matthew Seaman wrote:
On Wed, Sep 22, 2004 at 10:47:38AM -0700, Drew Tomlinson wrote:
 

OK, I'm trying to understand the difference.  According to the manual 
-ctime is change of file status and -mtime is last modification 
time.  I think I understand what modification means (changing the 
contents of the file) but what is change of file status?  In my 
particular situation, while reviewing my spam folder for possible ham, 
my IMAP client may change the message status from unread to read.  How 
would this affect the actual message file?
   

The ctime entry (originally 'creation time') used to be intended to
record when the file was created.  Nowadays it records the last time
the inode for the file changed -- that includes such things as changes
to file permissions, ACLs, option flags etc., but not such things as
modifications to the file contents which don't change the file size a
great deal.
This status has nothing to do with what your IMAP client reports as
the file status.  The ctime concept applies to any file on the system,
no matter what it's used for.  IMAP status just records or modifies an
extra header within the message to indicate if it's been read or not.
Thus reading those messages via IMAP might change mtime but not
ctime. However, I'm not certain of that.  You'll have to experiment.
You can print out the ctime and mtime for the files by:
   % stat -f 'ctime=%Sc mtime=%Sm   %N' -t '%c' *
Usually mtime and ctime will be exactly the same.
Cheers,
	Matthew
 

Thank you very much for the explanation.  I will use your stat example 
and do some investigating.

Drew
--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!
http://www.alchemistswarehouse.com


smime.p7s
Description: S/MIME Cryptographic Signature