Created
May 15, 2025 04:06
-
-
Save snappytux/980541ce5c62ba36497566e47a62eb50 to your computer and use it in GitHub Desktop.
find and delete all .DS_Store files in a directory and its subdirectories
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
#!/bin/bash | |
# Script to delete all .DS_Store files in the current directory and subdirectories | |
echo "Starting to search for and delete .DS_Store files..." | |
# Find and count all .DS_Store files | |
found_files=$(find . -type f -name ".DS_Store") | |
count=$(echo "$found_files" | grep -c "^") | |
if [ $count -eq 0 ]; then | |
echo "No .DS_Store files found." | |
exit 0 | |
fi | |
echo "Found $count .DS_Store files." | |
echo "Deleting files..." | |
# Find and delete all .DS_Store files | |
find . -type f -name ".DS_Store" -delete | |
echo "Successfully deleted $count .DS_Store files." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment