{"id":216,"date":"2015-04-27T19:37:17","date_gmt":"2015-04-27T18:37:17","guid":{"rendered":"http:\/\/www.sarbyn.com\/tech\/?p=216"},"modified":"2015-04-28T16:13:40","modified_gmt":"2015-04-28T15:13:40","slug":"delete-unwanted-jpg-files","status":"publish","type":"post","link":"https:\/\/www.sarbyn.com\/blog\/2015\/04\/27\/delete-unwanted-jpg-files\/","title":{"rendered":"Delete unwanted JPG files"},"content":{"rendered":"<p>How to select an huge amount of photos in CR2 (canon RAW format) and JPEG?<\/p>\n<p>After any photo shooting session I have always the same problem: select the right photos and delete the bad ones among hundreds clicks.<br \/>\nNormally I review the RAW files, then I select which photos need some post-processing actions and delete the wrong photos. After this first step, I need to delete the JPEG files corresponding to deleted CR2 raw photos.<br \/>\nI wrote this simple python script that searches for missing CR2 files and add a suffix &#8220;_DELETEME&#8221; to the corresponding JPG photo, in order to easily identifying the photos to delete.<\/p>\n<p>Disclaimer: this is my FIRST working python script<\/p>\n<p>Prerequisite: shoot in CR and JPG format using the same file name<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/python\r\nimport glob\r\nimport os.path\r\nfor image in glob.glob(&quot;*.JPG&quot;):\r\n   fileName = os.path.splitext(image)&#x5B;0]\r\n   print &quot;Checking &quot; + fileName\r\n   if (os.path.exists(fileName+&quot;.CR2&quot;) == False):\r\n      print &quot;Mark as DELETEME &quot; + image\r\n      os.rename(image, image+&quot;_DELETEME&quot;)\r\n\r\nprint &quot;Done! Review the DELETEME files and if it's all OK...delete them!&quot;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to select an huge amount of photos in CR2 (canon RAW format) and JPEG? After any photo shooting session I have always the same problem: select the right photos and delete the bad ones among hundreds clicks. Normally I review the RAW files, then I select which photos need some post-processing actions and delete <a class=\"read-more\" href=\"https:\/\/www.sarbyn.com\/blog\/2015\/04\/27\/delete-unwanted-jpg-files\/\">&hellip;&nbsp;<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":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[59],"tags":[60,57,61,62],"class_list":["post-216","post","type-post","status-publish","format-standard","hentry","category-random-things","tag-canon","tag-photo","tag-python","tag-utility"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3JApm-3u","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/216"}],"collection":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":15,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/216\/revisions"}],"predecessor-version":[{"id":233,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/216\/revisions\/233"}],"wp:attachment":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/media?parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/categories?post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/tags?post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}