From f4953a155445ed1690494075177bbb98f8cece58 Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Tue, 10 Jan 2023 15:20:06 -0500
Subject: [PATCH 1/2] Fix dir_prep and hidden dirs / existing symlinks

---
 functions.sh | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/functions.sh b/functions.sh
index 8fe5ae7e..e4a6fe78 100644
--- a/functions.sh
+++ b/functions.sh
@@ -502,6 +502,12 @@ dir_prep() {
     mv -f "$symlink" "$symlink.old"
   fi
 
+  # if the real dir is already a symlink, unlink it first
+  if [ -L "$real" ];
+  then
+    unlink "$real"
+  fi
+
   # if the real dir doesn't exist we create it
   if [ ! -d "$real" ];
   then
@@ -519,6 +525,7 @@ dir_prep() {
   then
     echo "Moving the data from $symlink.old to $real" #DEBUG
     mv -f "$symlink".old/* $real
+    mv -f "$symlink".old/.* $real # Also move hidden files / folders
     echo "Removing $symlink.old" #DEBUG
     rm -rf "$symlink.old"
   fi

From cec9321bbada463eaf4440c8c44ee75608752abe Mon Sep 17 00:00:00 2001
From: icenine451 <benjamin.r.shelton@protonmail.com>
Date: Tue, 10 Jan 2023 15:37:37 -0500
Subject: [PATCH 2/2] A better solution to moving hidden dirs

---
 functions.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/functions.sh b/functions.sh
index e4a6fe78..29de20bc 100644
--- a/functions.sh
+++ b/functions.sh
@@ -524,8 +524,7 @@ dir_prep() {
   if [ -d "$symlink.old" ];
   then
     echo "Moving the data from $symlink.old to $real" #DEBUG
-    mv -f "$symlink".old/* $real
-    mv -f "$symlink".old/.* $real # Also move hidden files / folders
+    mv -f "$symlink.old"/{.[!.],}* $real
     echo "Removing $symlink.old" #DEBUG
     rm -rf "$symlink.old"
   fi