From 69d134d9d176cad443b082b2237eb40de93ebf24 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Thu, 28 Jan 2021 23:42:38 +0100 Subject: [PATCH] fix: rework .octoprint folder remove function to be able to remove multiple instances --- scripts/remove.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/remove.sh b/scripts/remove.sh index 10e83d9..ac5962f 100755 --- a/scripts/remove.sh +++ b/scripts/remove.sh @@ -308,14 +308,18 @@ remove_octoprint(){ sudo rm -rf /etc/sudoers.d/octoprint-shutdown fi - ### remove OctoPrint and .octoprint directories + ### remove OctoPrint directory if [ -d ${HOME}/OctoPrint ]; then status_msg "Removing OctoPrint directory ..." rm -rf ${HOME}/OctoPrint && ok_msg "Directory removed!" fi - if [ -d ${HOME}/.octoprint* ]; then - status_msg "Removing .octoprint directory ..." - rm -rf ${HOME}/.octoprint* && ok_msg "Directory removed!" + + ###remove .octoprint directories + if [ "$(find ${HOME} -maxdepth 1 -name ".octoprint*")" ]; then + for folder in $(find ${HOME} -maxdepth 1 -name ".octoprint*") + do + status_msg "Removing $folder ..." && rm -rf $folder && ok_msg "Done!" + done fi CONFIRM_MSG=" OctoPrint successfully removed!"