{"id":573,"date":"2009-12-01T13:02:35","date_gmt":"2009-12-01T11:02:35","guid":{"rendered":"http:\/\/raftaman.net\/?p=573"},"modified":"2021-05-15T11:46:41","modified_gmt":"2021-05-15T09:46:41","slug":"573","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=573","title":{"rendered":"Find empty folders on Linux"},"content":{"rendered":"<p>Well, there is no native command (at least, afaik), but you can use <code><strong>find<\/strong><\/code> to easily identify empty folders (which maybe helpful for maintenance, etc.):<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# find \/path -type d -empty\r\n<\/pre>\n<p><\/p>\n<p>Find empty folder and list<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# find \/path -type d -empty -exec ls -ld {} \\;\r\n<\/pre>\n<p><\/p>\n<p>Find empty folder and save as temporary file<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# find \/path -type d -empty -exec ls -ld &gt;&gt; \/tmp\/savefiles.txt {} \\;\r\n<\/pre>\n<p><\/p>\n<p>Find empty folder and delete<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n# find \/path -type d -empty -exec rmdir {} \\;\r\n<\/pre>\n<p>See also <a href=\"http:\/\/linux.die.net\/man\/1\/find\">find manpage<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, there is no native command (at least, afaik), but you can use find to easily identify empty folders (which maybe helpful for maintenance, etc.): # find \/path -type d -empty Find empty folder and list # find \/path -type d -empty -exec ls -ld {} \\; Find empty folder and save as temporary file # find \/path -type d&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=573\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[28],"class_list":["post-573","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bash"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=573"}],"version-history":[{"count":20,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions"}],"predecessor-version":[{"id":2688,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/573\/revisions\/2688"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}