DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 970,177 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Katz Ueno
Katz Ueno

Posted on

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

Latest comments (0)

πŸ‘‹ Hey, my name is Noah and I’m the one who set up this ad. My job is to get you to join DEV, so if you fancy doing me a favor, I’d love for you to create an account.

If you found DEV from searching around, here are a couple of our most popular articles on DEV: