diff --git a/modules/filesystem/btrfs/btrfs.mod b/modules/filesystem/btrfs/btrfs.mod index 8bced0a..475b2f1 100644 --- a/modules/filesystem/btrfs/btrfs.mod +++ b/modules/filesystem/btrfs/btrfs.mod @@ -90,13 +90,14 @@ echo "~ $((subvolumeFolderSize/1024/1024)) GB" } +# https://unix.stackexchange.com/questions/93324/how-does-this-find-command-using-find-exec-sh-c-sh-work find_subvolumes() { dir=${1:-.} dep=${2:-1} - sudo /bin/find "$dir" -maxdepth $dep -type d -exec bash -c ' + sudo /bin/find "$dir" -mindepth 1 -maxdepth $dep -type d -exec bash -c ' for d do subv=$(basename $d) - sudo $BTRFS_BIN subvolume show "$d" >/dev/null 2>&1 && printf "%s\n" "$subv" + sudo '$BTRFS_BIN' subvolume show "$subv" >/dev/null 2>&1 && printf "%s\n" "$subv" done' find-sh {} + }