commit 648306b85ad72c21716ada5626d8983d62efb155 parent 998aab3b2001e4b3c99444dc3fcb15e23871722e Author: William Casarin <bill@casarin.me> Date: Mon, 22 Feb 2016 16:01:09 -0800 add hashshare Diffstat:
A | hashshare | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/hashshare b/hashshare @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +hash=$(sha1sum "$1" | awk '{ print $1 }') +hashlen=${2:-16} +shorthash=${hash:0:$hashlen} +filename=$(basename "$1") +ext="${filename##*.}" +sfilename="${shorthash}.${ext}" +sharefile -n $sfilename $1