How do I find all files of a specific type that are outside of a folder?
Solution 1:
Basically you take the list of applications found and filter out those who are in /Applications
:
find / -type d -iname *.app | grep -v '^/Applications' > ~/applications.txt
The more elaborated way skips /Applications
from the start and just lists .app
s found in other directories:
find / -type d \( \( -depth 1 -name Applications -prune \) -o -name '*.app' -print \)
In both cases you might get warning messages if find
tries to descend into a directory not accessible to the current user. You can prevent this by running the command with sudo
.
Solution 2:
Here's another solution using find
. We negate the predicate -path
with an !
- exclamation point. Use the -x
option to prevent descending into other devices (filesystems) and send any error messages to the bit bucket- 2>/dev/null
.
find -x / ! -path '/Applications/*' -type d -name '*.app' 2>/dev/null