feat: mover: second pass: only process directories

This commit is contained in:
Tom Mortensen
2025-05-21 10:53:52 -07:00
parent 34deed1f35
commit 4b4f8cb2ce

View File

@@ -27,7 +27,9 @@ CFGPATH="/boot/config/shares"
DEBUGGING=""
move() {
/usr/bin/find "$1" -depth 2>/dev/null | /usr/libexec/unraid/move $DEBUGGING
find "$1" -depth 2>/dev/null | /usr/libexec/unraid/move $2 $DEBUGGING
# second pass to clean up leftover empty directories
find "$1" -depth -type d 2>/dev/null | /usr/libexec/unraid/move $2 $DEBUGGING
}
start() {
@@ -104,7 +106,7 @@ empty() {
for SHAREPATH in /mnt/$DISK/* ; do
SHARE=$(basename "$SHAREPATH")
if [[ -d "$SHAREPATH" && -f "$CFGPATH/$SHARE.cfg" ]]; then
find "$SHAREPATH" -depth 2>/dev/null | /usr/libexec/unraid/move -e $DEBUGGING
move "$SHAREPATH" "-e"
fi
done