File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2770,8 +2770,18 @@ do_restore()
27702770
27712771 ITEM=" ${SPACE}${SPACE}${ALLSKY_MYFILES_NAME} "
27722772 if [[ -d ${ALLSKY_WEBSITE_MYFILES_DIR} ]]; then
2773- display_msg --log progress " ${ITEM} (moving back)"
2774- mv " ${ALLSKY_WEBSITE_MYFILES_DIR} " " ${PRIOR_WEBSITE_DIR} "
2773+ # If the prior directory exists, move the FILES in the current directory there,
2774+ # but don't move the whole directory or else we'll get a "mv" error.
2775+ D=" ${PRIOR_WEBSITE_DIR} /${ALLSKY_MYFILES_NAME} "
2776+ if [[ -d ${D} ]]; then
2777+ display_msg --log progress " ${ITEM} (moving contents back)"
2778+ (shopt -s dotglob
2779+ mv " ${D} " /* " ${ALLSKY_WEBSITE_MYFILES_DIR} " 2> /dev/null
2780+ )
2781+ else
2782+ display_msg --log progress " ${ITEM} (moving directory back)"
2783+ mv " ${ALLSKY_WEBSITE_MYFILES_DIR} " " ${PRIOR_WEBSITE_DIR} "
2784+ fi
27752785 else
27762786 display_msg --logonly info " ${ITEM} : ${NOT_RESTORED} "
27772787 fi
You can’t perform that action at this time.
0 commit comments