{"id":297,"date":"2008-10-12T12:03:39","date_gmt":"2008-10-12T10:03:39","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=297"},"modified":"2010-09-01T12:28:37","modified_gmt":"2010-09-01T10:28:37","slug":"files-created-last-x-hours-including-y-in-the-filename","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=297","title":{"rendered":"Files created last X hours including Y in the filename"},"content":{"rendered":"<p>This is a script that checks if there is a new file, contains a keyword, and that the file has been created last X hours. For example if you have a couple of servers uploading files every hours, you can check with this script if all servers have uploaded a new file the last hour. Even if the filename is not always the same, for example many applications add a timestamp to the filename like server05_20081012.<br \/>\nConfiguration.txt contains all keywords that should be included in a filename. Contoso_filecheck.hta is a GUI that you can use to add keyword, delete keywords and show current keywords. contoso_filechecker.vbs is the script that does the filecheck.<\/p>\n<ol>\n<li>The script counts number of files in the folder, that was created last X hours (default folder is C:\\LogFiles and default time is 24 hours)<\/li>\n<li>The script creates an array of all the files that was created last X hours<\/li>\n<li>The script loops all selected files and checks if the keyword is in the filename. It then moves on to the next keyword and loops all selected filenames.<\/li>\n<li>If the keyword, for example a server1, is in Configuration.txt but there is no file including server1 created last 24 hours, a local event will be created including the time configuration and the keyword.<\/li>\n<li>You can configure MOM 2005 or Ops Mgr to pickup these events and generate an alert.<\/li>\n<\/ol>\n<p>Download the script <a href=\"http:\/\/www.contoso.se\/files\/fileupdatecheck.zip\">here<\/a>.<\/p>\n<p><!-- ~ --><!-- ~ --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a script that checks if there is a new file, contains a keyword, and that the file has been created last X hours. For example if you have a couple of servers uploading files every hours, you can check with this script if all servers have uploaded a new file the last hour. &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=297\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[2,13],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/297"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=297"}],"version-history":[{"count":1,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":1772,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/297\/revisions\/1772"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}