Dave Smith wrote:
On Thu, Jul 19, 2001 at 11:24:05PM +0200, ob_ok@gmx.net wrote:
I would like the appearance of the LS output to be like under good old dos with "doscmd=/o:gen" or "dir /o:gen", that is directories sorted in a-z order FIRST, then the a-z sorted FILES.
I don't think there is a way to do this directly; you'll have to do it in a script. You could:
a) use perl: opendir, readdir, closedir will allow you to read the contents of a directory (to get the ls listing) if(-d xxx) will tell you if an entry is a directory if(! -d xxx) will tell you if an entry is not a directory sort will sort the list into alphanumeric order. b) use a shell script with find: the options you want to look up are: -maxdepth should allow you to restrict your find to just one directory -type d will choose only directories ! -type d will choose only non-directories -ls will run a form of ls on the result or -exec ls <options> '{}' \; will run whatever ls command you want on the result
Try this one-liner of wierdnesses: ls -Ud $(ls -Ap | grep '/$') $(ls -Ap | grep -v '/$') (Couldn't resist the challenge!) Paul