{"id":268,"date":"2015-07-19T21:26:28","date_gmt":"2015-07-19T20:26:28","guid":{"rendered":"http:\/\/frosteyes.dk\/?p=268"},"modified":"2015-07-19T21:26:28","modified_gmt":"2015-07-19T20:26:28","slug":"remove-duplicate-of-files","status":"publish","type":"post","link":"http:\/\/www.frosteyes.dk\/index.php\/linux\/remove-duplicate-of-files","title":{"rendered":"Remove duplicate of files"},"content":{"rendered":"<p>I had a number of folders on my MacBook. Each of them a full backup from a mobil phone, from different dates. To clean it up, I decided to only keep the elements in each folder, not present in the next folder.<\/p>\n<p>To do this, I started by creating a diff output<\/p>\n<pre lang=\"bash\">\r\ndiff -q -s folder1\/ folder2 > ~\/Desktop\/diffOutput.txt\r\n<\/pre>\n<p>This output contained both the uniq files, but also list the identical files.<\/p>\n<p>So to get a list of the identical file names, I used grep and cut, like the following.<\/p>\n<pre lang=\"bash\">\r\ngrep identical diffoutput.txt | grep -e \"folder1\/.* and\" -o | cut -f2 -d'\/' | cut -f1 -d' ' > ~\/Desktop\/diffParsed.txt\r\n<\/pre>\n<p>The last thing is to remove the identical files.<\/p>\n<pre lang=\"bash\">\r\ncat ~\/Desktop\/diffParsed.txt | xargs rm\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had a number of folders on my MacBook. Each of them a full backup from a mobil phone, from different dates. To clean it up, I decided to only keep the elements in each folder, not present in the next folder. To do this, I started by creating a diff output diff -q -s &hellip; <a href=\"http:\/\/www.frosteyes.dk\/index.php\/linux\/remove-duplicate-of-files\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Remove duplicate of files<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-linux","category-mac"],"_links":{"self":[{"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":8,"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"predecessor-version":[{"id":276,"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/posts\/268\/revisions\/276"}],"wp:attachment":[{"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.frosteyes.dk\/index.php\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}