Skip to content

Instantly share code, notes, and snippets.

@XayOn
Created January 30, 2012 16:04
Show Gist options
  • Save XayOn/1705151 to your computer and use it in GitHub Desktop.
Save XayOn/1705151 to your computer and use it in GitHub Desktop.
torrent_shorting_hat
#!/bin/bash
id=$1; name=$2; path=$3; source ~/.torrent-aliases
type=$(file -b --mime-type $path |cut -d/ -f1)
for dest_dir in ${!regexes[@]}; do mkdir -p ~/Media/$type/$dest_dir; [[ $path =~ ${regexes[$dest_dir]} ]] && { mv $path ~/Media/$type/$dest_dir/; exit; }; done
mv $path ~/Media/$type/$dest_dir # Fallback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment