Unix Programming - find in current directory - SUN OS

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2006 > find in current directory - SUN OS





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author find in current directory - SUN OS
shulamitm

2006-12-10, 1:39 am

Hello,

How can I find files in current directory only (not recursively) using
the UNIX 'find' command?

thanks!

Maxim Yegorushkin

2006-12-10, 7:25 am


shulamitm wrote:

> How can I find files in current directory only (not recursively) using
> the UNIX 'find' command?


$ find . -maxdepth 1 <tests>

You can find more information by typing:

$ man find

Gary R. Schmidt

2006-12-10, 7:25 am

shulamitm wrote:

> Hello,
>
> How can I find files in current directory only (not recursively) using
> the UNIX 'find' command?
>
> thanks!
>

ls -d[aA] *

Cheers,
Gary B-)

--
________________________________________
______________________________________
Armful of chairs: Something some people would not know
whether you were up them with or not
- Barry Humphries
Stephane CHAZELAS

2006-12-10, 1:18 pm

2006-12-9, 23:24(-08), shulamitm:
> Hello,
>
> How can I find files in current directory only (not recursively) using
> the UNIX 'find' command?

[...]

find . ! -name . -prune ...


Or, if you want "." as well:

find . \( -name . -o -prune \) ...

Which is the equivalent of GNU find

find . -maxdepth 1

--
Stéphane
Casper H.S. Dik

2006-12-10, 1:18 pm

"Maxim Yegorushkin" <maxim.yegorushkin@gmail.com> writes:


>shulamitm wrote:


[vbcol=seagreen]
> $ find . -maxdepth 1 <tests>


Non-standard find syntax; what about :

find . ! -name . -print -type d -prune

Am I the only one who believes that -maxdepth and -mindepth are
addition made by someone who did not understand find's syntax?

Clearly, it should have been something like:

find . -treedepth <num>

where <num> has the standard +/- syntax.

(-1 == -maxdepth 1, +1 == -mindepth 1; 1 == -maxdepth 1 -mindepth 1)

Casper
Jean-Rene David

2006-12-13, 1:19 pm

* Gary R. Schmidt [2006.12.10 12:44]:
> ls -d[aA] *


First time I see that syntax. It doesn't look like
a pattern.

Care to explain?

--
JR
Gary R. Schmidt

2006-12-14, 1:29 pm

Jean-Rene David wrote:
> * Gary R. Schmidt [2006.12.10 12:44]:
>
>
>
> First time I see that syntax. It doesn't look like
> a pattern.
>
> Care to explain?
>

It's how the man pages set out parameters, it means that the items
within the [..] are optional.

IOW:
ls -d *
ls -da *
ls -dA *

Determining the meaning of the options is left to the reader.

Cheers,
Gary B-)

--
________________________________________
______________________________________
Armful of chairs: Something some people would not know
whether you were up them with or not
- Barry Humphries
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com