3

Think of it as going to the most high level folder, doing a Ctrl Find, and searching .DS_Store and deleting them all.

I want them all deleted, from all subfolders and subfolders subfolders and so on. Basically inside the top level folder, there should be no .DS_Store file anywhere, not even in any of its subfolders.

What would be the command I should enter?

4
  • 2
    If you're on a mac they are going to automatically recreate themselves. Try this guide to disable it: pixelcog.com/blog/2016/disable-ds_store-in-el-capitan Commented Aug 27, 2017 at 13:41
  • The OP tagged Linux; can the OP confirm or deny being on MacOS? Commented Aug 27, 2017 at 13:46
  • @JeffSchaller Ah, I skipped over the tags. I just know of ds_store as a mac thing however I'm assuming he's copied the files off a mac to linux which is an issue I deal with often as well. Commented Aug 27, 2017 at 13:49
  • Yes I am on a linux machine Commented Aug 27, 2017 at 14:22

1 Answer 1

9
find top-folder -type f -name '.DS_Store' -exec rm -f {} + 

or, more simply,

find top-folder -type f -name '.DS_Store' -delete 

where top-folder is the path to the top folder you'd like to look under.

To print out the paths of the found files before they get deleted:

find top-folder -type f -name '.DS_Store' -print -exec rm -f {} + 
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.