How to remove .DS_Store files from external drive?

I know that to remove .DS_Store files on my internal drive, I just need to issue the following terminal command:


sudo find / -name ".DS_Store" -depth -exec rm {} \;


What is the terminal command to remove .DS_Store files from an external drive?


Also, when removing the .DS_Store files from the internal drive, there are quite a number of folders that seem to be protected in which the .DS_Store files are not removed. Is there a way to make sure that all .DS_Store files on the internal drive are deleted?


Steve

MacBook Pro TouchBar and Touch ID, macOS Sierra (10.12.6)

Posted on Nov 9, 2018 4:23 AM

Reply
2 replies

Nov 9, 2018 8:12 AM in response to greg sahli

I understand the purpose of these files. Unfortunately, they can easily get corrupted and adversely affect the very things that they are meant to help. Also, as in my case, when I do a clean install of an OS (Mohave) and migrate my entire cloned external drive back to my laptop, the presence of these files from the cloned drive mess with the Finder remembering folder size, position, etc. of some of my folders. So I want to completely eradicate them from both my laptop and my external drive. When they are rebuilt, they behave properly.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to remove .DS_Store files from external drive?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.