#!/bin/bash VERSION="20190214" function helpexit() { BS=$( basename "$0" ) echo "Diff the filenames and sizes in two folders" echo "Usage: $BS [-v] folder1 folder2" echo " -v view in vimdiff" exit } function _tree() { tree -s -v "$1" } VIMDIFF=0 FOLDERS=( ) for ((i=1; i<=${#@}; i++)) { [[ "${!i}" = "-h" ]] && helpexit [[ "${!i}" = "--help" ]] && helpexit [[ "${!i}" = "-v" ]] && { VIMDIFF=1; continue; } FOLDERS+=( "${!i}" ) } [[ ${#FOLDERS[@]} -eq 2 ]] || helpexit [[ "$VIMDIFF" -eq 1 ]] && { vimdiff <( _tree "${FOLDERS[0]}" ) <( _tree "${FOLDERS[1]}" ) } || { diff -y <( _tree "${FOLDERS[0]}" ) <( _tree "${FOLDERS[1]}" ) | \ HB_RULES='"|.*" "$c" ".*<" "$r" ">.*" "$g"' highbeam }