Use find
rather than ls
. With find
you can exclude one or more glob-expressions. For your example (and OSX), you could do
find * -depth 0 -type f ! -name '*.ogg' -ls
which produces something like an ls -l
(on just files, given the -type f
):
66294163 0 -rw-r--r-- 1 tom wheel 0 Sep 9 20:12 foo.mp4
With OSX, the first column is the inode value, and then the link-count. find
does not provide as many options for listing as ls
:
$ ls -l
total 0
drwx------ 3 thomas wheel 102 Sep 9 15:33 com.apple.launchd.OFStJ79qtq
drwx------ 3 thomas wheel 102 Sep 9 15:33 com.apple.launchd.VQsV1ae6bI
drwx------ 3 thomas wheel 102 Sep 9 15:33 com.apple.launchd.e6HBMt2vnS
drwx------ 3 thomas wheel 102 Sep 9 15:33 com.apple.launchd.he9U4OAIMI
-rw-r--r-- 1 tom wheel 0 Sep 9 20:12 foo.mp4
-rw-r--r-- 1 tom wheel 0 Sep 9 20:12 foo.ogg
but can be useful.
ls
does not automatically descend into subdirectories. Have you created an alias or function? What is the output oftype -a ls
?$ type -a ls
ls is /bin/ls
ls *
will descend because you're explicitly naming the directory. My bad. Plain ls with no arguments will not