[Gllug] Locating Subdirectories

John Hearns john.hearns at clustervision.com
Tue Jul 27 11:04:29 UTC 2004


On Tue, 2004-07-27 at 11:51, Mick Farmer wrote:
> Dear GLLUGers,
> 
> I need to obtain the names of all the subdirectories in the
> current directory.  I'm currently using the following.
> 
> 	find * -type d -maxdepth 0
> 
> Does anyone have anything simpler?
> 
Nope, but for fun way more complicated:
ls --directory -l * | grep ^d | sed 's/ \+/ /g' | cut -f 9 -d ' '

(do an ls, match with a d at the start, turn multiple spaces into one
space, cut out the directory name)

Sorry of there are flaws in this - I just tried it out.

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list