from Hacker News

Hazel for hackers

by nicoritschel on 12/16/12, 4:13 PM with 25 comments

  • by icebraining on 12/16/12, 10:29 PM

    Is there a great advantage over standard shell commands, besides being in Ruby? For example, the following rule:

      rule 'Trash old temporary files' do
        dir('~/Outbox/*.tmp.*').each do |p|
          trash(p) if 1.week.since?(modified_at(p))
        end
      end
    
    can be replaced with:

      #Trash old temporary files
      find ~/Outbox/ -iname '*.tmp.*' -mtime +7 -exec mv {} ~/.Trash \;
    
    The maid script may be more readable if you don't know 'find', but on the other hand, this has only one line.
  • by flogic on 12/16/12, 7:31 PM

    One of the areas where I disembark from the traditional Unix way is to replace "--dry-run" like flags with "--enable-destruction". That way I have to intentionally do the bad thing.
  • by zdw on 12/16/12, 6:22 PM

    A nice feature that could be implemented on OS X would be to auto-organize files by the domain they're downloaded from.

    Safari on OS X puts the source link of a downloaded file in the spotlight metadata, which can be accessed via "mdls" - an excerpt:

      $ mdls Inconsolata-Bold.ttf
        -- other metadata --
        kMDItemWhereFroms              = (
          "http://googlefontdirectory.googlecode.com/hg/ofl/inconsolata/Inconsolata-Bold.ttf,
          "http://code.google.com/p/googlefontdirectory/source/browse/ofl/inconsolata/Inconsolata-Bold.ttf
        )
    
    
    Personally, I'd find that much more useful than the "all pdf's are books" example.
  • by mr337 on 12/17/12, 6:42 AM

    Something that I recently started to do that seemed to help me it to point downloads of FF and Chrome to /tmp. So if I downloaded something important I immediately moved it to where it belonged.

    On reboot all the stuff you didn't care about is gone.

  • by andrethegiant on 12/17/12, 12:09 AM

    I like it, but prefer something like guard-shell which is event-driven: https://github.com/guard/guard-shell
  • by Xyzodiac on 12/16/12, 5:59 PM

    I've been meaning to try maid, I installed the gem but I've yet to do anything more. Thanks for posting this, as now I have some incentive to configure it.
  • by aes256 on 12/16/12, 5:16 PM

    This looks interesting. I've been using Hazel on OS X for a long time.

    Will have to give it a try...

  • by stratosvoukel on 12/16/12, 6:01 PM

    It looks great! yay! Now lets make something to take care of our rooms! :P
  • by terhechte on 12/16/12, 5:35 PM

    Would be great to have a repository with rules for this.
  • by drivebyacct2 on 12/16/12, 11:10 PM

    This is pretty much horrifying (to someone like me who likes to meticulously manage and know where things are instead of treating "Downloads" or "Desktop" like a flat-filesystem.

    Is it really that hard to just, you know, delete a few files whenever you download something? Download X. Okay. Download Y, go to open Y, delete X while you're there.

    Somehow I have 6 TB of data and it's all organized. I don't have any files on my Desktop or Downloads folder. Amazingly, I don't have to spend 4 minutes looking for something when I need to pull something up to look at it or send to a friend.