Last active
December 22, 2022 01:32
-
-
Save solarkraft/245caf3f3940a917126919e08a6fcefe to your computer and use it in GitHub Desktop.
Continually delete meta-files Finder keeps creating on external drives
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
#!/usr/bin/env bash | |
path=$1 | |
check() { | |
file=$1 | |
echo "Checking $file" | |
# Anything matching /._* | |
if [[ $file =~ \/\._. ]] || [[ $file =~ \/\.DS_Store ]]; then | |
echo "Shut up $file" | |
rm "$file" | |
fi | |
} | |
find $path | | |
while read file; do | |
check "$file" | |
done | |
inotifywait --event CLOSE_WRITE --monitor --format %w%f --recursive $path | | |
while read file; do | |
check "$file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment