{"id":2313,"date":"2017-12-08T07:16:02","date_gmt":"2017-12-08T07:16:02","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2313"},"modified":"2020-01-09T09:54:01","modified_gmt":"2020-01-09T09:54:01","slug":"identical-file-validation-using-shell-script","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/identical-file-validation-using-shell-script\/","title":{"rendered":"Identical file validation using shell script?"},"content":{"rendered":"<p><strong>scmuser created the topic: identical file validation using shell script?<\/strong><\/p>\n<p>Device a script that accepts two directory names, bar1 and bar2, and deletes those files in bar2 which are identical to their namesakes in bar1.<\/p>\n<p><strong>rajeshkumar replied the topic: Re: identical file validation using shell script?<\/strong><\/p>\n<p>Solution:<\/p>\n<p><code>#!\/bin\/bash<br \/>\ncd $1<br \/>\nfor file in * ; do<br \/>\nif [ -f ..\/$2\/$file ] ; then<br \/>\n        cmp $file ..\/$2\/$file >\/dev\/null 2>\/dev\/null && rm ..\/$2\/$file<br \/>\nfi<br \/>\ndone<\/code><\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>scmuser created the topic: identical file validation using shell script? Device a script that accepts two directory names, bar1 and bar2, and deletes those files in bar2 which are identical&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[454],"tags":[278],"class_list":["post-2313","post","type-post","status-publish","format-standard","hentry","category-shell-script","tag-script"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2313"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2313\/revisions"}],"predecessor-version":[{"id":2314,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2313\/revisions\/2314"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}