fix find_subvolumes

master
David Kebler 2024-08-21 12:40:04 -07:00
parent 3112ba0288
commit 79a85da5b2
1 changed files with 3 additions and 2 deletions

View File

@ -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 {} +
}