How to delete .DS_Store, or some system files recursively

katzueno

Katz Ueno

Posted on October 11, 2021

How to delete .DS_Store, or some system files  recursively

When you zip files in Mac OS or Windows, it sometime include system files that you don't see when you were working.

When you unzip the files, you see them.

You go nuts!

Well, you probably set .gitignore to ignore those system files. It will probably be harmless.

However, you just don't want to leave those junk.

You will use find command to delete them

Originally posted on my blog
https://en.katzueno.com/2021/10/11/how-to-delete-ds_store-php-files-recursively/

Delete .DS_Store or ._* files

cd [Path/To/UnarivedFolder]
find . -name ".DS_Store" -delete; find . -name "._*" -delete
Enter fullscreen mode Exit fullscreen mode

find command is very useful to delete some junk files systematically.

Delete .bak files

cd [Path/To/UnarivedFolder]
find . -name "*.bak" -delete
Enter fullscreen mode Exit fullscreen mode

TIPS: Configure your Mac not to save .DS_Store files

# Start terminal
# Set default not to store .DS_Store file
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
# Force restart Finder
killall Finder
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
katzueno
Katz Ueno

Posted on October 11, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related