pull-plex, automatically remove empty directories.

This commit is contained in:
me
2026-08-26 12:48:50 -07:00
parent 10b33b023c
commit 0c7adfadcb
+10 -2
View File
@@ -396,9 +396,16 @@ function pull-plex {
echo -e "\n`date` - Combining videos split into chunks."
cd "$dest"
ls | while read dir; do
echo -e "\n Checking '$dir'"
echo -e "\n\n`date` - Checking '$dir'"
ls -lh "$dir"/*.mkv 2>/dev/null ||
ls -lh "$dir"/* 2>/dev/null ||
{
echo " Directory is empty, removing."
rmdir -v "$dir"
echo " Skipping to next directory."
continue
}
cd "$dir"
ls -lh
# Unsure why -e and -f don't work here. Spaces in filenames? Globs?
if [[ `ls *.chunk0 2>/dev/null` ]]; then
final="$dir.mkv"
@@ -409,6 +416,7 @@ function pull-plex {
mv -v *.chunk* ~/TRASH/
fi
echo "`date` - Done."
cd ..
done
}