Help With Find Syntax

2005-10-14 Thread Drew Tomlinson
I want to recursively search a directory and return files that end in 
.jpg or .gif but I can't seem to get the find syntax right.  My 
basic command lines are:


find /multimedia/Pictures -iname *.gif -print

OR

find /multimedia/Pictures -iname *.jpg -print

Both of these work perfectly.  But I can't figure out how to combine the 
two.  'man find' tells me the the OR operator is '-or'.  Thus it seems 
that some incantation along this line would work:


$ find /multimedia/Pictures -iname *.gif -or *.jpg -print  
find: paths must precede expression

Usage: find [path...] [expression]

I've tried various placement of quotes, parenthesis, etc. but can't seem 
to find the right way to do this.  Can someone show me my error?


Thanks,

Drew

--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!

http://www.alchemistswarehouse.com

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


Re: Help With Find Syntax

2005-10-14 Thread Glenn Sieb
Drew Tomlinson said the following on 10/14/2005 2:53 PM:

 I want to recursively search a directory and return files that end in
 .jpg or .gif but I can't seem to get the find syntax right.  My
 basic command lines are:

 find /multimedia/Pictures -iname *.gif -print

 OR

 find /multimedia/Pictures -iname *.jpg -print


find /multimedia/Pictures \( -iname '*.gif' -or -iname '*.jpg' \) -print

That should do it for you.

Best,
--Glenn

-- 
They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety. 
  ~Benjamin Franklin, Historical Review of Pennsylvania, 1759

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


Re: Help With Find Syntax

2005-10-14 Thread Charles Swiger

On Oct 14, 2005, at 2:53 PM, Drew Tomlinson wrote:
$ find /multimedia/Pictures -iname *.gif -or *.jpg -print   
find: paths must precede expression

Usage: find [path...] [expression]

I've tried various placement of quotes, parenthesis, etc. but can't  
seem to find the right way to do this.  Can someone show me my error?


find /multimedia/Pictures -iname *.gif -or -iname *.jpg -print

--
-Chuck

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


Re: Help With Find Syntax

2005-10-14 Thread Drew Tomlinson

On 10/14/2005 12:05 PM Glenn Sieb wrote:


Drew Tomlinson said the following on 10/14/2005 2:53 PM:

 


I want to recursively search a directory and return files that end in
.jpg or .gif but I can't seem to get the find syntax right.  My
basic command lines are:

find /multimedia/Pictures -iname *.gif -print

OR

find /multimedia/Pictures -iname *.jpg -print
   




find /multimedia/Pictures \( -iname '*.gif' -or -iname '*.jpg' \) -print

That should do it for you.
 



OK, duh.  I get it now.  Thanks for pointing me in the right direction!

Thanks,

Drew

--
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books,  More!

http://www.alchemistswarehouse.com

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


RE: Help With Find Syntax

2005-10-14 Thread Mark J. Sommer
 -Original Message-
 From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Drew Tomlinson
 Sent: 10/14/2005 12:54 PM
 To: FreeBSD Questions
 Subject: Help With Find Syntax
 
 I want to recursively search a directory and return files that end in
.jpg or .gif but I can't seem to get the find syntax right.  My basic
command lines are:
 
 find /multimedia/Pictures -iname *.gif -print
 
 OR
 
 find /multimedia/Pictures -iname *.jpg -print
 
 Both of these work perfectly.  But I can't figure out how to combine the
two.  'man find' tells me the the OR operator is '-or'.  Thus it seems that
some incantation along this line would work:
 
 $ find /multimedia/Pictures -iname *.gif -or *.jpg -print  
 find: paths must precede expression
 Usage: find [path...] [expression]
 
 I've tried various placement of quotes, parenthesis, etc. but can't seem
to find the right way to do this.  Can someone show me my error?
 
 Thanks,
 
 Drew
 
Try:

find /multimedia/Pictures \( -iname '*.gif' -o -iname '*.jpg' \)


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


Re: Help With Find Syntax

2005-10-14 Thread Glenn Sieb
Drew Tomlinson said the following on 10/14/2005 3:13 PM:

 OK, duh.  I get it now.  Thanks for pointing me in the right direction!

Quite welcome! Enjoy!!

Best,
--Glenn

-- 
They that can give up essential liberty to obtain a little temporary 
safety deserve neither liberty nor safety. 
  ~Benjamin Franklin, Historical Review of Pennsylvania, 1759

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


Re: Help With 'find' Syntax

2003-11-01 Thread Drew Tomlinson
- Original Message -
From: David Carter-Hitchin [EMAIL PROTECTED]
To: Drew Tomlinson [EMAIL PROTECTED]
Sent: Friday, October 31, 2003 5:04 PM


 Hi Drew,

 Find is one of those classic commands for confusing people.  One just gets
 used to it over time.  The behaviour of find varies significantly with
 different unixes under different shells.

 Which shell are you using?

tcsh

 Under bash this command does what you want:

 find / -mtime 7 -size +1024c -ls -o -ctime 7 -size +1024c -ls

 the sense here is:

 find / (-mtime 7 -size +1024c -ls) -o (-ctime 7 -size +1024c -ls)

 meaning find (i.e. examine all files) from / and either

 a) print (-ls) files modified exactly 7 days old and greater than size
 1024 chars (bytes).

 or (-o)

 b) print (-ls) files whose inode creation times are exactly 7 days old and
 greater than size 1024 chars.

 If neither a) nor b) are true for a file found under / then it is silently
 ignored.

 You may find the following note from man find helpful:

 # All primaries which take a numeric argument allow the number to be pre-
 # ceded 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''.

 So that is why I put a + in from of 1024 - to find files over 1024 bytes
 (c).

This is the piece I was missing.  Thanks!

 So in your example below:

  find /usr \( -mtime 6 -ls -size 100 \) -o \( -ctime 6 -ls -size 100
  \) -print

 You are trying to find files that are exactly 100 512k blocks in
 size. Admittedly the files you found were not of this size and I don't
 know why they were found - I can replicate this on my machine here, but I
 don't know why - perhaps it is the file allocation.  This is why I chose
 1024c instead of block size.

  (And why is this file listed twice, anyway?)

 Perhaps because there was a symbolic link pointing to it (as shown by the
 '2' before the permissions).

Ah yes, that's why?  Thanks for your help and time.  Now if I could just
figure out where my disk space went...  I'm still not seeing anything
significant.  I'll go back and look (now that I know how) at Oct. 24 and see
if I can find anything there.

Thanks again!

Drew

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


Re: Help With 'find' Syntax

2003-11-01 Thread Drew Tomlinson
 - Original Message -
 From: Malcolm Kay [EMAIL PROTECTED]
 To: David Carter-Hitchin [EMAIL PROTECTED]; Drew
 Tomlinson [EMAIL PROTECTED]
 Sent: Friday, October 31, 2003 4:44 PM

 On Sat, 1 Nov 2003 11:34, David Carter-Hitchin wrote:
  Hi Drew,
 [snip]
  You may find the following note from man find helpful:
 
  # All primaries which take a numeric argument allow the number to be
pre-
  # ceded 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''.
 
  So that is why I put a + in from of 1024 - to find files over 1024
bytes
  (c).
 
  So in your example below:
   find /usr \( -mtime 6 -ls -size 100 \) -o \( -ctime 6 -ls -size 100
   \) -print
 
  You are trying to find files that are exactly 100 512k blocks in
  size. Admittedly the files you found were not of this size

 At each stage find applies the test argument and passes on files that
 remain to the next argument for manipulation. This in the first 'or'
branch
 everthing that satisfies -mtime 6 is passed on to -ls and thus displayed
 before it is filtered by the -size 100 argument. To do what Drew wanted
the
 -size +100 should be applied *before* the -ls.

Thank you.  Now I understand.

 (It is difficult to see why Drew would want to use both -ls and -print)

Because I don't know what I'm doing.  :)  Thanks for pointing out that this
is redundant.

Cheers,

Drew

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


Re: Help With 'find' Syntax -- SOLVED

2003-11-01 Thread Drew Tomlinson
Thank you to everyone for all your help!  Something must have 'puked' during
my nightly cvsup of the ports tree.  Every directory under /usr/ports had a
sysctl.core file.  By deleting these files, I recovered my disk space.

Thanks again!

Drew

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


Re: Help With 'find' Syntax

2003-10-31 Thread Drew Tomlinson
- Original Message - 
From: David Carter-Hitchin [EMAIL PROTECTED]
To: Drew Tomlinson [EMAIL PROTECTED]
Cc: FreeBSD Questions [EMAIL PROTECTED]
Sent: Thursday, October 30, 2003 5:55 PM
Subject: Re: Help With 'find' Syntax


 Hi Drew,

 This should find all files created or modified on 25th October:

 find / -mtime 6 -ls -o -ctime 6 -ls

 (As today is 31st October which is 6 days after 25th.  You may need to
 widen your search a little with a seperate search with 7 as the paramter
 as 6 may not catch files that were created over 6 * 24 hours ago (but were
 still on the 25th); not sure about that).

Thank you for your reply.  I tried your suggestion and it seems to get what
I want.  However there are so many little files that I thought I'd modify
the command to:

find /usr \( -mtime 6 -ls -size 100 \) -o \( -ctime 6 -ls -size 100
\) -print

If I understand the '-size' primary correctly, this means I would find files
that are '100 512-byte blocks' in size or '50k'.  Yet I still get output
like this:

7621552 -r--r--r--1 root wheel 928 Oct
25 15:12 /usr/local/man/man3/pcre_compile.3.gz

7621552 -r--r--r--1 root wheel 928 Oct
25 15:12 /usr/local/man/man3/pcre_compile.3.gz

(And why is this file listed twice, anyway?)  So I guess my question is how
can I find files created or modified on Oct. 25 and are larger than size?

Thanks for any help.  This is really confusing to me.

Drew


 HTH,
 David

 On Wed, 29 Oct 2003, Drew Tomlinson wrote:

  On October 25, my /usr partition lost nearly 50% of it's available
space.
  This disk hasn't had any significant size changes since I built the
system
  as it basically serves as a gateway.
 
  I'm trying to use the find command to determine what may have been
written
  to the disk but am not having any luck.  I see primaries such
  as -atime, -mtime, -ctime, and -newer and have read the man pages but do
not
  understand what the best combination to find those files.  Basically how
do
  I use 'find' to show me all file that were created or modified on
October
  25?  I've tried commands such as find /usr \( -newerct 4d \! -newerct
3d
  \) -print but nothing is returned.
 
  Thanks,
 
  Drew
 
  ___
  [EMAIL PROTECTED] mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to
[EMAIL PROTECTED]
 
 
 



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


Re: Help With 'find' Syntax

2003-10-31 Thread David Carter-Hitchin
Hi Drew,

Find is one of those classic commands for confusing people.  One just gets
used to it over time.  The behaviour of find varies significantly with
different unixes under different shells.

Which shell are you using?

Under bash this command does what you want:

find / -mtime 7 -size +1024c -ls -o -ctime 7 -size +1024c -ls

the sense here is:

find / (-mtime 7 -size +1024c -ls) -o (-ctime 7 -size +1024c -ls)

meaning find (i.e. examine all files) from / and either

a) print (-ls) files modified exactly 7 days old and greater than size
1024 chars (bytes).

or (-o)

b) print (-ls) files whose inode creation times are exactly 7 days old and
greater than size 1024 chars.

If neither a) nor b) are true for a file found under / then it is silently
ignored.  

You may find the following note from man find helpful:

# All primaries which take a numeric argument allow the number to be pre-
# ceded 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''.

So that is why I put a + in from of 1024 - to find files over 1024 bytes
(c).

So in your example below:

 find /usr \( -mtime 6 -ls -size 100 \) -o \( -ctime 6 -ls -size 100
 \) -print

You are trying to find files that are exactly 100 512k blocks in
size. Admittedly the files you found were not of this size and I don't
know why they were found - I can replicate this on my machine here, but I
don't know why - perhaps it is the file allocation.  This is why I chose
1024c instead of block size.

 (And why is this file listed twice, anyway?)

Perhaps because there was a symbolic link pointing to it (as shown by the
'2' before the permissions).

HTH,
David

On Fri, 31 Oct 2003, Drew Tomlinson wrote:

 - Original Message - 
 From: David Carter-Hitchin [EMAIL PROTECTED]
 To: Drew Tomlinson [EMAIL PROTECTED]
 Cc: FreeBSD Questions [EMAIL PROTECTED]
 Sent: Thursday, October 30, 2003 5:55 PM
 Subject: Re: Help With 'find' Syntax
 
 
  Hi Drew,
 
  This should find all files created or modified on 25th October:
 
  find / -mtime 6 -ls -o -ctime 6 -ls
 
  (As today is 31st October which is 6 days after 25th.  You may need to
  widen your search a little with a seperate search with 7 as the paramter
  as 6 may not catch files that were created over 6 * 24 hours ago (but were
  still on the 25th); not sure about that).
 
 Thank you for your reply.  I tried your suggestion and it seems to get what
 I want.  However there are so many little files that I thought I'd modify
 the command to:
 
 find /usr \( -mtime 6 -ls -size 100 \) -o \( -ctime 6 -ls -size 100
 \) -print
 
 If I understand the '-size' primary correctly, this means I would find files
 that are '100 512-byte blocks' in size or '50k'.  Yet I still get output
 like this:
 
 7621552 -r--r--r--1 root wheel 928 Oct
 25 15:12 /usr/local/man/man3/pcre_compile.3.gz
 
 7621552 -r--r--r--1 root wheel 928 Oct
 25 15:12 /usr/local/man/man3/pcre_compile.3.gz
 
 (And why is this file listed twice, anyway?)  So I guess my question is how
 can I find files created or modified on Oct. 25 and are larger than size?
 
 Thanks for any help.  This is really confusing to me.
 
 Drew
 
 
  HTH,
  David
 
  On Wed, 29 Oct 2003, Drew Tomlinson wrote:
 
   On October 25, my /usr partition lost nearly 50% of it's available
 space.
   This disk hasn't had any significant size changes since I built the
 system
   as it basically serves as a gateway.
  
   I'm trying to use the find command to determine what may have been
 written
   to the disk but am not having any luck.  I see primaries such
   as -atime, -mtime, -ctime, and -newer and have read the man pages but do
 not
   understand what the best combination to find those files.  Basically how
 do
   I use 'find' to show me all file that were created or modified on
 October
   25?  I've tried commands such as find /usr \( -newerct 4d \! -newerct
 3d
   \) -print but nothing is returned.
  
   Thanks,
  
   Drew
  
   ___
   [EMAIL PROTECTED] mailing list
   http://lists.freebsd.org/mailman/listinfo/freebsd-questions
   To unsubscribe, send any mail to
 [EMAIL PROTECTED]
  
  
  
 
 
 
 
 
 

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


Re: Help With 'find' Syntax

2003-10-31 Thread Malcolm Kay
On Sat, 1 Nov 2003 11:34, David Carter-Hitchin wrote:
 Hi Drew,
[snip]
 You may find the following note from man find helpful:

 # All primaries which take a numeric argument allow the number to be pre-
 # ceded 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''.

 So that is why I put a + in from of 1024 - to find files over 1024 bytes
 (c).

 So in your example below:
  find /usr \( -mtime 6 -ls -size 100 \) -o \( -ctime 6 -ls -size 100
  \) -print

 You are trying to find files that are exactly 100 512k blocks in
 size. Admittedly the files you found were not of this size 

At each stage find applies the test argument and passes on files that
remain to the next argument for manipulation. This in the first 'or' branch
everthing that satisfies -mtime 6 is passed on to -ls and thus displayed
before it is filtered by the -size 100 argument. To do what Drew wanted the 
-size +100 should be applied *before* the -ls.

(It is difficult to see why Drew would want to use both -ls and -print)

 and I don't
 know why they were found - I can replicate this on my machine here, but I
 don't know why - perhaps it is the file allocation.  This is why I chose
 1024c instead of block size.


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


Re: Help With 'find' Syntax

2003-10-30 Thread David Carter-Hitchin
Hi Drew,

This should find all files created or modified on 25th October:

find / -mtime 6 -ls -o -ctime 6 -ls

(As today is 31st October which is 6 days after 25th.  You may need to
widen your search a little with a seperate search with 7 as the paramter
as 6 may not catch files that were created over 6 * 24 hours ago (but were
still on the 25th); not sure about that).

HTH,
David

On Wed, 29 Oct 2003, Drew Tomlinson wrote:

 On October 25, my /usr partition lost nearly 50% of it's available space.
 This disk hasn't had any significant size changes since I built the system
 as it basically serves as a gateway.
 
 I'm trying to use the find command to determine what may have been written
 to the disk but am not having any luck.  I see primaries such
 as -atime, -mtime, -ctime, and -newer and have read the man pages but do not
 understand what the best combination to find those files.  Basically how do
 I use 'find' to show me all file that were created or modified on October
 25?  I've tried commands such as find /usr \( -newerct 4d \! -newerct 3d
 \) -print but nothing is returned.
 
 Thanks,
 
 Drew
 
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 
 
 

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


Help With 'find' Syntax

2003-10-29 Thread Drew Tomlinson
On October 25, my /usr partition lost nearly 50% of it's available space.
This disk hasn't had any significant size changes since I built the system
as it basically serves as a gateway.

I'm trying to use the find command to determine what may have been written
to the disk but am not having any luck.  I see primaries such
as -atime, -mtime, -ctime, and -newer and have read the man pages but do not
understand what the best combination to find those files.  Basically how do
I use 'find' to show me all file that were created or modified on October
25?  I've tried commands such as find /usr \( -newerct 4d \! -newerct 3d
\) -print but nothing is returned.

Thanks,

Drew

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