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."
|
echo -e "\n`date` - Combining videos split into chunks."
|
||||||
cd "$dest"
|
cd "$dest"
|
||||||
ls | while read dir; do
|
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"
|
cd "$dir"
|
||||||
ls -lh
|
|
||||||
# Unsure why -e and -f don't work here. Spaces in filenames? Globs?
|
# Unsure why -e and -f don't work here. Spaces in filenames? Globs?
|
||||||
if [[ `ls *.chunk0 2>/dev/null` ]]; then
|
if [[ `ls *.chunk0 2>/dev/null` ]]; then
|
||||||
final="$dir.mkv"
|
final="$dir.mkv"
|
||||||
@@ -409,6 +416,7 @@ function pull-plex {
|
|||||||
|
|
||||||
mv -v *.chunk* ~/TRASH/
|
mv -v *.chunk* ~/TRASH/
|
||||||
fi
|
fi
|
||||||
|
echo "`date` - Done."
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user