From 79a85da5b2f90da644739953cdeb3bde86a9fc6d Mon Sep 17 00:00:00 2001 From: David Kebler Date: Wed, 21 Aug 2024 12:40:04 -0700 Subject: [PATCH] fix find_subvolumes --- modules/filesystem/btrfs/btrfs.mod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 {} + }