[wplug] ls puzzle

Brandon Kuczenski brandon at 301south.net
Sun Oct 3 18:04:26 EDT 2004


the challenge: how to list all files in a directory, but omit
subdirectories?  I've come up with the following, but would like something
more efficient:

ls -l | grep -v ^d | awk ' { print $NF } '

This method actually works well, but it loses filenames with spaces in
them.

Ideas for improvement?

apropos: the purpose of this is to come up with a directory listing to
feed into an image viewer (qiv), i.e.:

ls -l | grep -v ^d | awk ' { print $NF } ' > - && qiv -IftF -

I would [eventually] like to replicate the behavior of ACDSee on
Windows, where I double-click on an image and it opens that image, but I
can then use keystrokes [PgUp and PgDn, in ACDSee's case] to view other
files in the directory, without having to open them explicitly.

In fact, ACDsee is especially nice, because it only loads the current
image and the ones immediately 'before' and 'after' it at a time, even in
a directory with thousands of images, so that there's minimal memory
usage.

ACDsee is the only program I've paid for in recent memory (and it wasn't
even recent -- I bought version 2.6 in 2000!) except for games.

-Brandon



More information about the wplug mailing list