If you're a macOS user, you've probably come across those pesky .DS_Store
files that macOS creates to store metadata about directories. These files can clutter your file system, and sometimes you just want to get rid of them.
Here's a useful alias that finds and deletes all .DS_Store
files within the current directory and its subdirectories, while providing verbose output so you can see which files are being removed:
alias rm-dsstore='find . -name ".DS_Store" -type f -exec rm -v {} \;'
To use this alias, add it to your shell configuration file (e.g., .bashrc
, .zshrc
) and then run source ~/.bashrc
(or the corresponding file for your shell) to apply the changes. After that, you can simply use rm-dsstore
in your terminal to clean up those .DS_Store
files hassle-free.
In summary, this one-command solution makes it easy to clean up .DS_Store
files not only from your local directories but also from your GitHub repositories, ensuring a clutter-free and polished project presentation.