{"id":2278,"date":"2014-06-18T19:08:16","date_gmt":"2014-06-18T16:08:16","guid":{"rendered":"http:\/\/9v.lt\/blog\/?p=2278"},"modified":"2022-01-19T08:34:39","modified_gmt":"2022-01-19T06:34:39","slug":"deleting-duplicate-files-different-name","status":"publish","type":"post","link":"https:\/\/9v.lt\/blog\/deleting-duplicate-files-different-name\/","title":{"rendered":"Deleting duplicate files with different name"},"content":{"rendered":"<p>So this thing happened, on one computer after restoration all of the files somehow got duplicated. I am not sure how that happened, but by duplicate I mean there were the same folders but with _2 in the end. Each folder had exactly the same files as in a normal folder. Every good folder had subfoldes that were the also duplicated and named *_2.<br \/>\nObviously this can&#8217;t be cleaned by hand, so here&#8217;s a script I made to clean such a mess. It can be applied to any pattern, just change to match your situation in <em>dir \/b \/s \/a:d &#8220;*_2&#8221;<\/em><\/p>\n<pre lang=\"batch\">\r\n@echo off\r\necho.\r\nfor \/f \"tokens=*\" %%P in ('dir \/b \/s \/a:d \"*_2\"') do call :loop \"%%P\"\r\n:loop\r\nif '%1' == '' goto :endloop\r\nrd \/S \/Q %1\r\necho %1 was deleted.\r\n:endloop\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>So this thing happened, on one computer after restoration all of the files somehow got<\/p>\n","protected":false},"author":2,"featured_media":2277,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,750],"tags":[908,237,909],"class_list":["post-2278","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","category-software-projects","tag-duplicate","tag-files","tag-remove"],"_links":{"self":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts\/2278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/comments?post=2278"}],"version-history":[{"count":0,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/posts\/2278\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/media\/2277"}],"wp:attachment":[{"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/media?parent=2278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/categories?post=2278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/9v.lt\/blog\/wp-json\/wp\/v2\/tags?post=2278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}