list files but not directory

Albert Graham agraham at g-b.net
Fri Aug 21 12:36:30 UTC 2009


On 08/21/2009 12:58 PM, ann kok wrote:
> Hi
>
> any way to list files but not directory
>
> Thank you
>
>
>        __________________________________________________________________
> The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
>
>    

Seems like a very reasonable request and its a shame that ls does not 
provide such an option (which I guess would be an extension to the -A 
option)

Anyhow, if its OK to use grep, try this.


ls -1A --indicator-style=slash |grep -v -E "/$"

The --indicator adds a / to the end of dirs, the grep excludes entries 
that end in /

Albert.








More information about the users mailing list