pull-plex, automatically remove empty directories.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user