How To Get Rid of Those (Annoying!) .DS_Store Files
Ever just open up your local repository to commit and push some updates you forgot about, and you notice your working directory is full of
I'm writing this short article on an early morning because I have had just about enough of them! They pop out of nowhere and seriously, what are they even useful for?🙄
Because I never remember the commands to remove them and need to look it up every time, I'm putting this up as a quick personal resource.
Call it a sticky note if you will.
Steps to Take
If you're currently in a directory with un-staged changes and you spot DS_Store files with different directories, this is a quick reminder to navigate outside to the main parent directory so you can get rid of them at once.
Yeah, that happened to me and I was too frustrated to realise quickly 😬.
Commands You Can Use
1) Delete only files, exclude directories
find . -name '.DS_Store' -type f -delete
2) Delete all
find . -name '.DS_Store' -delete
- Ensure you're in the parent directory.
- It's handy for other types of files, replace the name, or type, that you want to delete.
P.S If you know a way to permanently stop its creation and you come across this post, kindly spare someone the wasted hours of scouring the internet and share.
Thanks in advance!