Skip to content

Instantly share code, notes, and snippets.

@systemswizard
Last active March 11, 2025 08:25
Show Gist options
  • Save systemswizard/6ae4446e779cf57b4fe737e856a3b1ef to your computer and use it in GitHub Desktop.
Save systemswizard/6ae4446e779cf57b4fe737e856a3b1ef to your computer and use it in GitHub Desktop.
searches a mac for .DS_Store directories and fails if any are found and returns a multi-line output if there are more than one found
#!/bin/bash
# macos-util-find-DS_Store.sh inspired by https://github.com/krypted/DS_Store_Folders
# searches a mac for .DS_Store directories and fails if any are found and returns a multi-line output if there are more than one found
# https://gist.github.com/systemswizard
if [[ $(mdfind kind:folders AND kMDItemDisplayName:.DS_Store) ]]; then
echo ".DS_Store folder(s) found"
exit 1
else
echo "Could not find any .DS_Store folders"
exit 0
fi
exit 99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment