zsh-users
 help / color / mirror / code / Atom feed
* `ls *(.)` shows "just files", what shows "just folders"?
@ 2011-08-15  1:08 TJ Luoma
  2011-08-15  1:39 ` Pete Johns
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: TJ Luoma @ 2011-08-15  1:08 UTC (permalink / raw)
  To: Zsh Users

Somewhere along the way I learned that

	ls *(.)

will tell 'ls' to only show files (not links, not directories)

Is there a similar command which would show _only_ directories?

(I've been using `find * -maxdepth 0 -type d` but I assume this is
'more efficient')

TjL


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  1:08 `ls *(.)` shows "just files", what shows "just folders"? TJ Luoma
@ 2011-08-15  1:39 ` Pete Johns
  2011-08-15  1:40 ` Michael Shick
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Pete Johns @ 2011-08-15  1:39 UTC (permalink / raw)
  To: TJ Luoma; +Cc: Zsh Users

On Sun, 2011-08-14 at 21:08:39 -0400, TJ Luoma sent:
>Somewhere along the way I learned that
>
>	ls *(.)
>
>will tell 'ls' to only show files (not links, not directories)
>
>Is there a similar command which would show _only_ directories?
>
Unsurprisingly, yes!

    ls -d *(/)

This is described here: http://linux.die.net/man/1/zshexpn

Hope this helps;


--paj


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  1:08 `ls *(.)` shows "just files", what shows "just folders"? TJ Luoma
  2011-08-15  1:39 ` Pete Johns
@ 2011-08-15  1:40 ` Michael Shick
  2011-08-15  1:41 ` Vincent Lefevre
  2011-08-15 15:38 ` Tristan Webb
  3 siblings, 0 replies; 10+ messages in thread
From: Michael Shick @ 2011-08-15  1:40 UTC (permalink / raw)
  To: TJ Luoma; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

*(/) is the glob you're looking for.  To just list the folders and not their
contents, you'd use `ls -d *(/)`.
On Aug 14, 2011 9:35 PM, "TJ Luoma" <luomat@gmail.com> wrote:
> Somewhere along the way I learned that
>
> ls *(.)
>
> will tell 'ls' to only show files (not links, not directories)
>
> Is there a similar command which would show _only_ directories?
>
> (I've been using `find * -maxdepth 0 -type d` but I assume this is
> 'more efficient')
>
> TjL

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  1:08 `ls *(.)` shows "just files", what shows "just folders"? TJ Luoma
  2011-08-15  1:39 ` Pete Johns
  2011-08-15  1:40 ` Michael Shick
@ 2011-08-15  1:41 ` Vincent Lefevre
  2011-08-15  1:43   ` Vincent Lefevre
  2011-08-15  2:24   ` TJ Luoma
  2011-08-15 15:38 ` Tristan Webb
  3 siblings, 2 replies; 10+ messages in thread
From: Vincent Lefevre @ 2011-08-15  1:41 UTC (permalink / raw)
  To: zsh-users

On 2011-08-14 21:08:39 -0400, TJ Luoma wrote:
> Somewhere along the way I learned that
> 
> 	ls *(.)
> 
> will tell 'ls' to only show files (not links, not directories)
> 
> Is there a similar command which would show _only_ directories?

ls -- *(/)

See "Glob Qualifiers" in the zshexpn man page.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  1:41 ` Vincent Lefevre
@ 2011-08-15  1:43   ` Vincent Lefevre
  2011-08-15  2:24   ` TJ Luoma
  1 sibling, 0 replies; 10+ messages in thread
From: Vincent Lefevre @ 2011-08-15  1:43 UTC (permalink / raw)
  To: zsh-users

On 2011-08-15 03:41:37 +0200, Vincent Lefevre wrote:
> On 2011-08-14 21:08:39 -0400, TJ Luoma wrote:
> > Somewhere along the way I learned that
> > 
> > 	ls *(.)
> > 
> > will tell 'ls' to only show files (not links, not directories)
> > 
> > Is there a similar command which would show _only_ directories?
> 
> ls -- *(/)
> 
> See "Glob Qualifiers" in the zshexpn man page.

I forgot: you probably also want the -d ls option: ls -d -- *(/)

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  1:41 ` Vincent Lefevre
  2011-08-15  1:43   ` Vincent Lefevre
@ 2011-08-15  2:24   ` TJ Luoma
  2011-08-15  2:48     ` Pete Johns
  2011-08-15  7:18     ` Sebastian Tramp
  1 sibling, 2 replies; 10+ messages in thread
From: TJ Luoma @ 2011-08-15  2:24 UTC (permalink / raw)
  To: zsh-users

On Sun, Aug 14, 2011 at 9:41 PM, Vincent Lefevre <vincent@vinc17.net> wrote:
> See "Glob Qualifiers" in the zshexpn man page.
>

Thanks to all…

Not to be greedy, but is there a way to get the listing without the
trailing "/"?

(I mean, I know I can get rid of it using `| sed 's#/$##g'` or `| tr -d '\57'`)

TjL


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  2:24   ` TJ Luoma
@ 2011-08-15  2:48     ` Pete Johns
       [not found]       ` <CADjGqHuu7-=rK1OKyYw05n4LmZ4yVGEKGGbKwvjaUocHk2Qmqg@mail.gmail.com>
  2011-08-15  7:18     ` Sebastian Tramp
  1 sibling, 1 reply; 10+ messages in thread
From: Pete Johns @ 2011-08-15  2:48 UTC (permalink / raw)
  To: zsh-users

On Sun, 2011-08-14 at 22:24:22 -0400, TJ Luoma sent:
>Not to be greedy, but is there a way to get the listing without
>the trailing "/"?
>
    \ls -d *(/)

This does not display a trailing slash. Are you specifying -F
(append file type indicators) in an alias or something?

Regards;

--paj


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
       [not found]       ` <CADjGqHuu7-=rK1OKyYw05n4LmZ4yVGEKGGbKwvjaUocHk2Qmqg@mail.gmail.com>
@ 2011-08-15  7:00         ` Pete Johns
  0 siblings, 0 replies; 10+ messages in thread
From: Pete Johns @ 2011-08-15  7:00 UTC (permalink / raw)
  To: TJ Luoma, zsh-users

On Mon, 2011-08-15 at 01:56:00 -0400, TJ Luoma sent:
>On Sun, Aug 14, 2011 at 10:48 PM, Pete Johns <pete@j...> wrote:
>> On Sun, 2011-08-14 at 22:24:22 -0400, TJ Luoma sent:
>>>Not to be greedy, but is there a way to get the listing without
>>>the trailing "/"?
>>>
>>    \ls -d *(/)
>>
>> This does not display a trailing slash. Are you specifying -F
>> (append file type indicators) in an alias or something?
>
>Aha!
>
>setopt MARK_DIRS
>
>was turned on.
>
Happy to help;


--paj


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  2:24   ` TJ Luoma
  2011-08-15  2:48     ` Pete Johns
@ 2011-08-15  7:18     ` Sebastian Tramp
  1 sibling, 0 replies; 10+ messages in thread
From: Sebastian Tramp @ 2011-08-15  7:18 UTC (permalink / raw)
  To: TJ Luoma; +Cc: zsh-users

On Sun, Aug 14, 2011 at 10:24:22PM -0400, TJ Luoma wrote:

> > See "Glob Qualifiers" in the zshexpn man page.
>
> Thanks to all…
>
> Not to be greedy, but is there a way to get the listing without the
> trailing "/"?

it sounds for me that you want to use the output for another command so
I suggest to use

print *(/)

instead of using ls (and stumble upon its aliases), this is much more
stable regarding environment changes.

Best regards

Sebastian Tramp

-- 
Sebastian Tramp
WebID: http://sebastian.tramp.name


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: `ls *(.)` shows "just files", what shows "just folders"?
  2011-08-15  1:08 `ls *(.)` shows "just files", what shows "just folders"? TJ Luoma
                   ` (2 preceding siblings ...)
  2011-08-15  1:41 ` Vincent Lefevre
@ 2011-08-15 15:38 ` Tristan Webb
  3 siblings, 0 replies; 10+ messages in thread
From: Tristan Webb @ 2011-08-15 15:38 UTC (permalink / raw)
  To: zsh-users

Hi Tj,

I'm not sure that this is optimal but I use:

   ls -d *(/)

Tristan
On Sun, Aug 14, 2011 at 09:08:39PM -0400, TJ Luoma wrote:
> Somewhere along the way I learned that
> 
> 	ls *(.)
> 
> will tell 'ls' to only show files (not links, not directories)
> 
> Is there a similar command which would show _only_ directories?
> 
> (I've been using `find * -maxdepth 0 -type d` but I assume this is
> 'more efficient')
> 
> TjL

-- 
Tristan Webb
PhD Student

Department of Computer Science
and Complexity Science Doctoral Training Centre
Warwick, UK
Tel: 024 765 73789 (Work)
Tel: 01926334727 (Home)
Mobile: 077 082 19078
Website: http://www.warwick.ac.uk/go/tristanwebb
Identi.ca: ksira


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-08-15 20:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-15  1:08 `ls *(.)` shows "just files", what shows "just folders"? TJ Luoma
2011-08-15  1:39 ` Pete Johns
2011-08-15  1:40 ` Michael Shick
2011-08-15  1:41 ` Vincent Lefevre
2011-08-15  1:43   ` Vincent Lefevre
2011-08-15  2:24   ` TJ Luoma
2011-08-15  2:48     ` Pete Johns
     [not found]       ` <CADjGqHuu7-=rK1OKyYw05n4LmZ4yVGEKGGbKwvjaUocHk2Qmqg@mail.gmail.com>
2011-08-15  7:00         ` Pete Johns
2011-08-15  7:18     ` Sebastian Tramp
2011-08-15 15:38 ` Tristan Webb

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).