Add missing subdirectory if parent directory exists
Mostly when a new year begins
This commit is contained in:
12
piwisync.sh
12
piwisync.sh
@@ -19,14 +19,22 @@ fi
|
|||||||
subDir="$myyear/"
|
subDir="$myyear/"
|
||||||
thumbRoot="${piwiThumbRoot}/${subDir}"
|
thumbRoot="${piwiThumbRoot}/${subDir}"
|
||||||
photoRoot="${piwiPhotoRoot}/${subDir}"
|
photoRoot="${piwiPhotoRoot}/${subDir}"
|
||||||
|
local yearRegex='[0-9]{4}'
|
||||||
|
|
||||||
if [ ! -e ${thumbRoot} ] ; then
|
if [ ! -e ${thumbRoot} ] ; then
|
||||||
echo "Thumbnail root ${thumbRoot} not found"
|
if [ -w ${piwiThumbRoot} ] && [[ "$subDir" =~ $yearRegex ]] ; then
|
||||||
|
# Thumb root of piwigo available just subdir missing
|
||||||
|
echo " [I] Adding missing year subdirectory $(basename $subDir) to $piwiThumbRoot"
|
||||||
|
echo " Happy new year $(basename $subDir) I guess ;)"
|
||||||
|
mkdir -p "$thumbRoot"
|
||||||
|
else
|
||||||
|
echo " [E] Thumbnail root ${thumbRoot} not found"
|
||||||
exit 1;
|
exit 1;
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e ${photoRoot} ] ; then
|
if [ ! -e ${photoRoot} ] ; then
|
||||||
echo "Photo root ${photoRoot} not found"
|
echo " [E] Photo root ${photoRoot} not found"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user