{"id":1643,"date":"2016-02-29T02:12:01","date_gmt":"2016-02-29T10:12:01","guid":{"rendered":"http:\/\/systemsolver.com\/StatlerBlog\/?p=1643"},"modified":"2016-02-29T02:12:01","modified_gmt":"2016-02-29T10:12:01","slug":"linux-folderfile-watcher","status":"publish","type":"post","link":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/2016\/02\/29\/linux-folderfile-watcher\/","title":{"rendered":"Linux folder\/file watcher"},"content":{"rendered":"<p>goal = create a notification system for when a file appears in a watched folder<\/p>\n<p>it would be nice if there was a gui to set the folder(s) to watch, selectable from the yad icon.<\/p>\n<p>on log in:<br \/>\nstart iwatch and yad to check for when files are created. Yad will provide an icon in the tray to open the folder, it will also popup until it is clicked on or x seconds.<br \/>\ncheck in a folder for the existence of any files<br \/>\nif files exist the do this:<br \/>\nwait a little time<br \/>\npopup a message<\/p>\n<p>iwatch <a href=\"http:\/\/iwatch.sourceforge.net\/documentation.html\">http:\/\/iwatch.sourceforge.net\/documentation.html<\/a><\/p>\n<p>yad <a href=\"https:\/\/sourceforge.net\/projects\/yad-dialog\/\">https:\/\/sourceforge.net\/projects\/yad-dialog\/<\/a><\/p>\n<p>yad wiki <a href=\"https:\/\/sourceforge.net\/p\/yad-dialog\/wiki\/browse_pages\/\">https:\/\/sourceforge.net\/p\/yad-dialog\/wiki\/browse_pages\/<\/a><\/p>\n<p>iwatch and yad are available in the linux mint depositories<\/p>\n<p>create a file likethis.sh and call it during boot up<\/p>\n<p>=== iwatch and yad ====<\/p>\n<pre>#!\/bin\/bash<\/pre>\n<pre># iwatch -c \"gnome-open \/home\/tpetersen\/Music\" -e create `\/home\/tpetersen<\/pre>\n<pre>yad --notification --image=update.png --text \"file ready\" --command=\"yad --file-selection --filename=\/etc\"<\/pre>\n<p>&nbsp;<\/p>\n<p>=== a command to check for empty directory ====<\/p>\n<pre class=\"lang-bsh prettyprint prettyprinted\">find \/path\/to\/dir -maxdepth 0 -empty -exec echo {} is empty. \\;<\/pre>\n<p>=== a command to make a path into a url ====<\/p>\n<pre class=\"lang-bsh prettyprint prettyprinted\"><code><span class=\"pln\">$ path<\/span><span class=\"pun\">=<\/span><span class=\"str\">\"\/home\/MHC\/directory with spaces and \u00fcml\u00e4uts\"\n<\/span><span class=\"pln\">$ echo $path <\/span><span class=\"pun\">|<\/span><span class=\"pln\"> perl <\/span><span class=\"pun\">-<\/span><span class=\"pln\">MURI<\/span><span class=\"pun\">::<\/span><span class=\"pln\">file <\/span><span class=\"pun\">-<\/span><span class=\"pln\">e <\/span><span class=\"str\">'print URI::file-&gt;new(&lt;STDIN&gt;).\"\\n\"'<\/span><span class=\"pln\"> \nfile<\/span><span class=\"pun\">:\/\/\/<\/span><span class=\"pln\">home<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">MHC<\/span><span class=\"pun\">\/<\/span><span class=\"pln\">directory<\/span><span class=\"pun\">%<\/span><span class=\"lit\">20with<\/span><span class=\"pun\">%<\/span><span class=\"lit\">20spaces<\/span><span class=\"pun\">%<\/span><span class=\"lit\">20and<\/span><span class=\"pun\">%<\/span><span class=\"lit\">20<\/span><span class=\"pun\">%<\/span><span class=\"pln\">C3<\/span><span class=\"pun\">%<\/span><span class=\"typ\">BCml<\/span><span class=\"pun\">%<\/span><span class=\"pln\">C3<\/span><span class=\"pun\">%<\/span><span class=\"pln\">A4uts \n$<\/span><\/code><\/pre>\n<p>==== command to make yad create a clickable link ====<\/p>\n<pre><b>--show-uri<\/b><\/pre>\n<p>====<\/p>\n","protected":false},"excerpt":{"rendered":"<p>goal = create a notification system for when a file appears in a watched folder it would be nice if there was a gui to set the folder(s) to watch, selectable from the yad icon. on log in: start iwatch and yad to check for when files are created. Yad will provide an icon in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1643","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts\/1643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/comments?post=1643"}],"version-history":[{"count":0,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts\/1643\/revisions"}],"wp:attachment":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/media?parent=1643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/categories?post=1643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/tags?post=1643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}