{"id":6588,"date":"2025-07-25T08:54:25","date_gmt":"2025-07-25T06:54:25","guid":{"rendered":"https:\/\/www.hanshafner.de\/blog\/?p=6588"},"modified":"2025-07-25T08:57:25","modified_gmt":"2025-07-25T06:57:25","slug":"macos-delete-ds_store-files-to-reset-folder-settings","status":"publish","type":"post","link":"https:\/\/www.hanshafner.de\/blog\/2025\/07\/25\/macos-delete-ds_store-files-to-reset-folder-settings\/","title":{"rendered":"macOS: Delete .DS_Store files to reset folder settings"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The following  command will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Only delete .DS_Store files<\/li>\n\n\n\n<li>Only in the folder you choose (not its subfolders)<\/li>\n\n\n\n<li>Not require your password<\/li>\n\n\n\n<li>Not touch system files<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In order to run the following commands, the Terminal will have to have access to your storage devices. Read <a href=\"https:\/\/www.hanshafner.de\/blog\/2025\/07\/25\/on-macos-enable-full-disk-access-for-terminal\/\">this blog post<\/a> to learn how to enable Full Disk Access for Terminal.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Instructions:<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open Terminal<br>Press Command + Space, type Terminal, then press Return.<\/li>\n\n\n\n<li>Type find, then a space. Don\u2019t press Return yet.<\/li>\n\n\n\n<li>Drag the folder into the Terminal window.<br>This automatically inserts the correct file path \u2014 even if the path contains spaces or it&#8217;s on an external drive.<br>For example, it might look like this:<br>find \/Volumes\/My\\ External\\ Drive\/Some\\ Folder<br>(You\u2019ll see backslashes \\ before spaces \u2014 that\u2019s normal.)<\/li>\n\n\n\n<li>Complete the command by adding this to the end:<br>-maxdepth 1 -name .DS_Store -delete<br>So the full command might look like:<br>find \/Volumes\/My\\ External\\ Drive\/Some\\ Folder -maxdepth 1 -name .DS_Store -delete<\/li>\n\n\n\n<li>Press Return. That\u2019s it!<br>If there\u2019s a .DS_Store file in that folder, it will be deleted instantly. You won\u2019t get a confirmation message \u2014 Terminal just does it.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Quick note about paths:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the Terminal, spaces are used to separate parts of a command \u2014 like the command itself from the options and file or folder names. So if a folder is called\u00a0<code>My Folder<\/code>, typing it without any special formatting (like\u00a0<code>My Folder<\/code>) will confuse the Terminal into thinking you&#8217;re referring to two separate things (&#8220;My&#8221; and &#8220;Folder&#8221;). To fix this, you can\u00a0<strong>escape the space<\/strong>\u00a0with a backslash (<code>\\<\/code>), like this:\u00a0<code>My\\ Folder<\/code>. This tells the Terminal, \u201ctreat the space as part of the name.\u201d Another option is to wrap the entire path in\u00a0<strong>quotes<\/strong>, like\u00a0<code>\"My Folder\"<\/code>, which also works. But important:\u00a0<strong>don\u2019t combine the two<\/strong>\u00a0\u2014 a backslash inside quotes (like\u00a0<code>\"My\\ Folder\"<\/code>) <strong>will not<\/strong> work and will actually break the command. Use\u00a0<strong>either backslashes or quotes<\/strong>, but not both.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Examples:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Deleteing &#8220;.DS_Store&#8221; from the Desktop folder:<br><code>find ~\/Desktop -maxdepth 1 -name .DS_Store -delete<br><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Deleteing &#8220;.DS_Store&#8221; from the Documents folder:<br><code>find ~\/Documents -maxdepth 1 -name .DS_Store -delete<br><\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">External drive folder (just drag the folder in):<br><code>find \/Volumes\/My\\ USB\\ Stick\/Project\\ Files -maxdepth 1 -name .DS_Store -delete<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">What this does NOT do:<br>It does not delete anything else.<br>It does not go into subfolders (so it&#8217;s very safe).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following command will: In order to run the following commands, the Terminal will have to have access to your storage devices. Read this blog post to learn how to enable Full Disk Access for Terminal. Step-by-Step Instructions: Quick note about paths: In the Terminal, spaces are used to separate parts of a command \u2014 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,174,233],"tags":[234],"class_list":["post-6588","post","type-post","status-publish","format-standard","hentry","category-blog-2","category-lifestream","category-tools","tag-macos"],"_links":{"self":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts\/6588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/comments?post=6588"}],"version-history":[{"count":5,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts\/6588\/revisions"}],"predecessor-version":[{"id":6593,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/posts\/6588\/revisions\/6593"}],"wp:attachment":[{"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/media?parent=6588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/categories?post=6588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hanshafner.de\/blog\/wp-json\/wp\/v2\/tags?post=6588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}