1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/zsh setopt extendedglob no_unset cd $0:h/done || exit $? current=( *(@) ) keep=( $current:A:t ) for d in *(/); do if (($+keep[(r)${d:t}])); then print -r keep: $d else btrfs sub del $d fi done