Created
August 31, 2020 17:03
-
-
Save crwolff/11de27d14a34cc47557f4fe287c553af to your computer and use it in GitHub Desktop.
Find all directories containing only certain files (from SO)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type d -exec bash -O dotglob -c ' | |
for dirpath do | |
ok=true | |
seen_files=false | |
set -- "$dirpath"/* | |
for name do | |
[ -d "$name" ] && continue # skip dirs | |
seen_files=true | |
case "${name##*/}" in | |
*.tmp|desktop.ini|Thumbs.db|.picasa.ini) ;; # do nothing | |
*) ok=false; break | |
esac | |
done | |
"$seen_files" && "$ok" && printf "%s\n" "$dirpath" | |
done' bash {} + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment