Re: Looking for files older than n number of days?

2005-06-06 Thread Francisco Reyes

On Sun, 5 Jun 2005, Dan Nelson wrote:


I ran it on a directory and was surprised to find that both -5 AND +5
listed a file from February. :-(


-5 definitely should not, and doesn't on my system.  It should be
interpreted as less than 5 days from midnight tonight.


I think I found a bug in find.
If you add the '-ls' parameter before the -mtime it ignores mtime.
Example:
find . -ls -mtime -5d
Shows all files in directory.


find . -mtime -5d -ls
Shows correctly files modified less than 5 days old.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for files older than n number of days?

2005-06-06 Thread Jerry McAllister
 
 On Sun, 5 Jun 2005, Dan Nelson wrote:
 
  I ran it on a directory and was surprised to find that both -5 AND +5
  listed a file from February. :-(
 
  -5 definitely should not, and doesn't on my system.  It should be
  interpreted as less than 5 days from midnight tonight.
 
 I think I found a bug in find.
 If you add the '-ls' parameter before the -mtime it ignores mtime.
 Example:
 find . -ls -mtime -5d
 Shows all files in directory.
 
 
 find . -mtime -5d -ls
 Shows correctly files modified less than 5 days old.

I am not sure it is exactly a bug.  It seems to be dependant on how
find processes its parameters - in order of occurance.   A similar effect
can be seen with some other parameter combinations such as putting -print
in the wrong place - you can get all files in the system printed or none
rather than just what you want.   Possibly the man page needs to be
updated to make the effect of parameter order clear.

jerry

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

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


Re: Looking for files older than n number of days?

2005-06-06 Thread Dan Nelson
In the last episode (Jun 06), Jerry McAllister said:
  I think I found a bug in find.
  If you add the '-ls' parameter before the -mtime it ignores mtime.
  Example:
  find . -ls -mtime -5d
  Shows all files in directory.
  
  find . -mtime -5d -ls
  Shows correctly files modified less than 5 days old.
 
 I am not sure it is exactly a bug.  It seems to be dependant on how
 find processes its parameters - in order of occurance.  A similar
 effect can be seen with some other parameter combinations such as
 putting -print in the wrong place - you can get all files in the
 system printed or none rather than just what you want.  Possibly the
 man page needs to be updated to make the effect of parameter order
 clear.

Correct.  Each primary returns 'true' or 'false', and the first 'false'
primary causes process to end for that file.

OPERATORS
 The primaries may be combined using the following operators.  The
 operators are listed in order of decreasing precedence.
[...]
 expression -and expression
 expression expression
  The -and operator is the logical AND operator.  As it is
  implied by the juxtaposition of two expressions it does not
  have to be specified.  The expression evaluates to true if
  both expressions are true.  The second expression is not
  evaluated if the first expression is false.

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


Re: Looking for files older than n number of days?

2005-06-06 Thread Francisco Reyes

On Mon, 6 Jun 2005, Jerry McAllister wrote:


find . -mtime -5d -ls
Shows correctly files modified less than 5 days old.


in the wrong place - you can get all files in the system printed or none
rather than just what you want.   Possibly the man page needs to be
updated to make the effect of parameter order clear.


And that would probably be simpler too than changing the code too.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for files older than n number of days?

2005-06-06 Thread Francisco Reyes

On Mon, 6 Jun 2005, Dan Nelson wrote:


OPERATORS
The primaries may be combined using the following operators.  The
operators are listed in order of decreasing precedence.
[...]
expression -and expression
expression expression
 The -and operator is the logical AND operator.  As it is
 implied by the juxtaposition of two expressions it does not
 have to be specified.  The expression evaluates to true if
 both expressions are true.  The second expression is not
 evaluated if the first expression is false.


Does that mean that -ls always evaluates to false?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for files older than n number of days?

2005-06-06 Thread Jerry McAllister
 
 In the last episode (Jun 06), Jerry McAllister said:
   I think I found a bug in find.
   If you add the '-ls' parameter before the -mtime it ignores mtime.
   Example:
   find . -ls -mtime -5d
   Shows all files in directory.
   
   find . -mtime -5d -ls
   Shows correctly files modified less than 5 days old.
  
  I am not sure it is exactly a bug.  It seems to be dependant on how
  find processes its parameters - in order of occurance.  A similar
  effect can be seen with some other parameter combinations such as
  putting -print in the wrong place - you can get all files in the
  system printed or none rather than just what you want.  Possibly the
  man page needs to be updated to make the effect of parameter order
  clear.
 
 Correct.  Each primary returns 'true' or 'false', and the first 'false'
 primary causes process to end for that file.
 
 OPERATORS
  The primaries may be combined using the following operators.  The
  operators are listed in order of decreasing precedence.
 [...]
  expression -and expression
  expression expression
   The -and operator is the logical AND operator.  As it is
   implied by the juxtaposition of two expressions it does not
   have to be specified.  The expression evaluates to true if
   both expressions are true.  The second expression is not
   evaluated if the first expression is false.

Unfortunately, that kind of precise operational language blows right
by someone with not much experience with such things.That is true
of many points of documentation.   It often takes some more conversational
type language to unlock the official language.

jerry

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


Re: Looking for files older than n number of days?

2005-06-06 Thread Dan Nelson
In the last episode (Jun 06), Francisco Reyes said:
 On Mon, 6 Jun 2005, Dan Nelson wrote:
 OPERATORS
 The primaries may be combined using the following operators. 
 The operators are listed in order of decreasing precedence.
 [...]
 expression -and expression
 expression expression
  The -and operator is the logical AND operator.  As it is
  implied by the juxtaposition of two expressions it does not
  have to be specified.  The expression evaluates to true if
  both expressions are true.  The second expression is not
  evaluated if the first expression is false.
 
 Does that mean that -ls always evaluates to false?

Nope; find . -ls -ls  will print every filename twice.  You might
want to list every filename for logging purposes, then do some other
processing (-delete maybe, or something called via -exec) on certain
other conditions.  More manpage pasting:

 -ls This primary always evaluates to true.  The following
 information for the current file is written to standard
 output: its inode number, size in 512-byte blocks, file
 permissions, number of hard links, owner, group, size in
 bytes, last modification time, and pathname.

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


Re: Looking for files older than n number of days?

2005-06-06 Thread Paul Schmehl
--On Sunday, June 05, 2005 23:47:44 -0400 Francisco Reyes 
[EMAIL PROTECTED] wrote:



On Sun, 5 Jun 2005, Paul Schmehl wrote:


Use negation.
find ! -n 10 blah


Could not get it to work with anything like that syntax.
For starters I don't see -n. I see newer but that seems to compare to
another file.. Is this something you have done in the past?

All I gave you was an example of how negation works, not a specific command 
for find.


Try this: find {path} ! -newer {path to file with date you want}

Or you can touch a file with the date you want.  Then use that file as the 
key for find to know what ! -newer means.


Take a look at this:

http://www.softpanorama.org/Tools/Find/find_mini_tutorial.shtml

There's tons of ways to do what you want.  You just need to choose one that 
you like.


Paul Schmehl ([EMAIL PROTECTED])
Adjunct Information Security Officer
University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu/ir/security/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for files older than n number of days?

2005-06-05 Thread Dan Nelson
In the last episode (Jun 05), Francisco Reyes said:
 Looking at the man page for find I see several ways to look for files
 exactly N days old or newer than N days, but did not see a flag for
 files older than N number of days.. like files older than 90 days...
 Did I miss it?

find . -mtime +5 , or find . -mtime +5d, depending on whether you
want 5 days as of the next midnight, or 5 days as of when find was
started.

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


Re: Looking for files older than n number of days?

2005-06-05 Thread Paul Schmehl
--On June 5, 2005 10:01:23 PM -0400 Francisco Reyes [EMAIL PROTECTED] 
wrote:



Looking at the man page for find I see several ways to look for files
exactly N days old or newer than N days, but did not see a flag for files
older than N number of days.. like files older than 90 days... Did I miss
it?


Use negation.

find ! -n 10 blah

Paul Schmehl ([EMAIL PROTECTED])
Adjunct Information Security Officer
University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for files older than n number of days?

2005-06-05 Thread Francisco Reyes

On Sun, 5 Jun 2005, Paul Schmehl wrote:


Use negation.
find ! -n 10 blah


Could not get it to work with anything like that syntax.
For starters I don't see -n. I see newer but that seems to compare to 
another file.. Is this something you have done in the past?

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


Re: Looking for files older than n number of days?

2005-06-05 Thread Francisco Reyes

On Sun, 5 Jun 2005, Dan Nelson wrote:


find . -mtime +5 , or find . -mtime +5d, depending on whether you
want 5 days as of the next midnight, or 5 days as of when find was
started.


How do those flags work?
+5 = changed during last five days?
-5 = newer than five days?

I ran it on a directory and was surprised to find that both -5 AND +5 
listed a file from February. :-(

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


Re: Looking for files older than n number of days?

2005-06-05 Thread Dan Nelson
In the last episode (Jun 05), Francisco Reyes said:
 On Sun, 5 Jun 2005, Dan Nelson wrote:
  find . -mtime +5 , or find . -mtime +5d, depending on whether
  you want 5 days as of the next midnight, or 5 days as of when find
  was started.
 
 How do those flags work?
 +5 = changed during last five days?
 -5 = newer than five days?

From the bottom of the PRIMARIES section of the manpage:

 All primaries which take a numeric argument allow the number to be
 preceded by a plus sign (``+'') or a minus sign (``-'').  A
 preceding plus sign means ``more than n'', a preceding minus sign
 means ``less than n'' and neither means ``exactly n''.
 
 I ran it on a directory and was surprised to find that both -5 AND +5
 listed a file from February. :-(

-5 definitely should not, and doesn't on my system.  It should be
interpreted as less than 5 days from midnight tonight.

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