hlean 0.1.1

UPDATE: hlean 0.1.2 available

I needed a program to find duplicate files in my constantly growing jungle, commonly referred to as a $HOME directory. I also needed a real motivation to sit down and write something in Haskell. After several cups of tea, I realized I could kill both birds with one heavy laser-targetting sniper rifle. After all, isn’t that what they say about Haskell: once you can get it to compile, you’re almost done?

hlean.hs is a command line program that takes any number of directories passed as arguments, recursively find all files, hashes them (defaults to sha256), and asks what to do with any duplicate sets found. It works fine for me, but since this is the first release, there are certainly some rough edges and caveats. Additionally, only you are responsible for your data; use this at your own risk: I cannot be held responsible if your computer blows up in a freak fire accident and coincidentally all the monkeys escape from the zoo.

Rough edges:

  • All the Haskell hash function libraries I’ve tried are either too slow or don’t handle large files very well, hence I was currently forced to use an external command line hashing function.
  • sha256 is the default command line hash. If you are not running FreeBSD, you will most likely need to modify two functions: hashCommand and hashCommandParse.
  • Eventually, I will either find a suitable Haskell library or make a more user-friendly configuration setup.
  • The “move file” action does not give the user a nice shell-like directory tab autocomplete. It would be nice to find a Readline prompt that does.

Ugliness:

  • I’ve made a cabal package, but currently the ghc compiled version seg faults. The runhaskell version works perfectly fine, which has left me very confused. I will look into this more when I have the time, but I’ve uploaded both versions in case someone would like to help me debug the issue. Fixed in hlean 0.1.2

Haskell: hlean.hs
Cabal Package: hlean-0.1.1.tar.gz

Usage:
runhaskell hlean.hs [dirs]

Feel free to leave any comments, bug reports, or feature requests.