How to ls --ignore on osx

hoss picture hoss · Jun 26, 2012 · Viewed 7.1k times · Source

I'm trying to do the following on OSX:

ls -lR --ignore *.app

So that I can recursively search through all folders except for .app folders.

However it seems there is seems to be no --ignore or --hide options in Darwin.

Perhaps a script to recursively search one folder deep for a given set and I'm not sure I cant pipe ls -lR through anything because of the format of the output:

./ROOT/Applications/Some_app:
drwxr-xr-x   3 admin  root  102 26 Jun 11:03 app-bundle.app  #<- WANT THIS
drwxr-xr-x@ 24 admin  root  816 26 Jun 11:24 folder          #<- WANT THIS

./ROOT/Applications/Some_app/app-bundle.app:                 #<- DON'T WANT
drwxr-xr-x  7 admin  root  238 26 Jun 11:03 Contents         #<- DON'T WANT
...

Answer

Rob Napier picture Rob Napier · Jun 26, 2012

Use find:

find . -ls -name '*.app' -prune