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

Re: Get directories names



On Tue, Nov 09, 2004 at 05:09:51PM -0500, Tong wrote:
> Hi, 
> 
> I used to use the following command/alias to get the names under the
> current directory in RH:
> 
> ls -l <criteria> | grep ^d | cut -c57-
> 
> but in Debian, the position of the file name is not fixed. 
> 
> How do you get it? Thanks

find . -maxdepth 1 -type d
or
find . -maxdepth 1 -type d|cut -c3- |grep -v '^\.'
if you want just the names, and no directories with names starting with
'.'

Frank

-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan



Reply to: