[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dir /ad - equiv



hi ya bounce

find / -type d -ls

or use -print instead  of -ls

c ya
alvin


On Mon, 16 Apr 2001 bounce-debian-user=aoga=Mail.Linux-Consulting.com@lists.debian.org wrote:

> What is the best way to get the equivalent of the DOS command 
> "dir /ad" in linux?  That command will show just the (sub)directories 
> and not ordinary files.
> 
> I thought that "ls -d" would be the equivalent but it is not. 
> 
> I know I can do "ls -f | grep /" to get the directory, but putting it
> into a script like this fails because the / does not appear when the
> output of ls is redirected:
> -----------------------------------
> #!/bin/sh
> if [ ! -z "$1" ]
> then
> 	WAAR=$1
> else
> 	WAAR=.
> fi
> ls -f $WAAR | grep /
> ----------------------------------
> 
> The following script works:
> -----------------------------
> #!/bin/sh
> if [ ! -z "$1" ]
> then
> 	WAAR=$1
> else
> 	WAAR=.
> fi
> ls -la $WAAR | grep ^d
> -----------------------------
> 
> Is there another way of doing this?
> Johann
> -- 
> J.H. Spies - Tel. 082 782 0336.  Posbus 4668, Tygervallei 7536
>      "But seek ye first the kingdom of God, and his  
>       righteousness; and all these things shall be added 
>       unto you."     Matthew 6:33 
> 
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 



Reply to: