Mac에서 Android SDK 설치를 망쳤습니다. "android"에 대한 모든 참조를 찾아서 정리하고 싶습니다.
문제는 명령을 실행할 때 find / -name "*android*"
꽤 광범위한 목록이 나온다는 것입니다.
이 목록 대신:
/usr/local/var/lib/android-sdk
/usr/local/var/lib/android-sdk/platforms/android-23
/usr/local/var/lib/android-sdk/platforms/android-24
/usr/local/var/lib/android-sdk/platforms/android-25
/usr/local/var/lib/android-sdk/platforms/android-26
/usr/local/var/lib/android-sdk/platforms/android-19
/usr/local/var/lib/android-sdk/platforms/android-28
/usr/local/var/lib/android-sdk/platforms/android-N
/usr/local/var/lib/android-sdk/system-images/android-23
/usr/local/var/lib/android-sdk/system-images/android-19
/usr/local/var/lib/android-sdk/system-images/android-N
...
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-15
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-16
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-18
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-20
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-21
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-19
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-10
/Library/Frameworks/Xamarin.Android.framework/Versions/5.1.2-1/lib/mandroid/platforms/android-17
난 갖길 원해:
/usr/local/var/lib/android-sdk
/Library/Frameworks/Xamarin.Android.framework
디렉터리가 일치하면 하위 디렉터리를 검색하지 않습니다.
답변1
디렉토리만 필요한 경우:
find . -type d -iname '*android*' -a \( -prune \)
코드 주석:
. # Present directory
-type d # Only directories
-iname # Instead of `-name` to also match "Android" (ignore case).
'*android*' # Pattern of name to search
-a # Force the execution of next option on matching names.
# probably redundant as all options are evaluated with an
# implicit and in find
# but: makes the intent explicitly clear.
\( -prune \) # Remove the whole directory from further examination.
# braces also optional (as it is only one command).
단순화하다:
find . -type d -iname '*android*' -prune
파일도 원하는 경우:
find . -iname '*android*' -a \( -prune \)
참고: 발견된 모든 파일과 디렉터리가 보고됩니다. "android"라는 파일이 발견되면 해당 디렉터리를 피해야 하는지 여부는 불분명합니다.