{"id":4169,"date":"2014-07-30T11:40:22","date_gmt":"2014-07-30T16:40:22","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=4169"},"modified":"2014-07-30T13:29:13","modified_gmt":"2014-07-30T18:29:13","slug":"finding-windows-os-files-modified-in-time-range-with-python","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2014\/07\/30\/finding-windows-os-files-modified-in-time-range-with-python\/","title":{"rendered":"Finding windows OS files modified in time range with python"},"content":{"rendered":"<p>We had a need to search some text files in Windows modified during a certain time range with a given piece of text.  This is a network drive that is not indexed, so we couldn&#8217;t quickly rely on a windows search.<\/p>\n<p>We came up with what is below&#8230;<\/p>\n<pre lang=\"python\">\r\nimport os\r\nfrom time import localtime\r\nfiles = os.listdir('w:\/nascar\/pimfeed\/ean\/')\r\nfor f in files:\r\n  p = localtime(os.path.getmtime('w:\/nascar\/pimfeed\/ean\/' + f)) \r\n  #find files modified since April 2014, inclusive\r\n  if p[0] == 2014 and (p[1] >= 4):\r\n    print \"processing\",f, \"modified on\",p[0],\"\/\",p[1],\"\/\",p[2]\r\n    for line in open('w:\/nascar\/pimfeed\/ean\/' + f,\"r\"):\r\n      if line.find(\"1187574362005036\") > -1:\r\n        print f,\"has it!\"\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We had a need to search some text files in Windows modified during a certain time range with a given piece of text. This is a network drive that is not indexed, so we couldn&#8217;t quickly rely on a windows&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2014\/07\/30\/finding-windows-os-files-modified-in-time-range-with-python\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[26],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/4169"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=4169"}],"version-history":[{"count":8,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/4169\/revisions"}],"predecessor-version":[{"id":4177,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/4169\/revisions\/4177"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4169"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}