From e422459f6cfb3b87a71c9b7fda077093c1555c6b Mon Sep 17 00:00:00 2001
From: SinTan1729 <sayantan.santra689@gmail.com>
Date: Sun, 2 Mar 2025 15:53:09 -0600
Subject: [PATCH] fix: Ignore subdirectories in folderify

---
 folderify.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/folderify.sh b/folderify.sh
index ef9042c..5cac43d 100644
--- a/folderify.sh
+++ b/folderify.sh
@@ -14,14 +14,14 @@ process_file () {
     else
         mkdir "$without_ext"
         mv "$filename" "$without_ext/"
-        find . -type f -regextype posix-egrep -iregex "\./$without_ext(\.[a-z]{2,3})?\.srt" \
+        find . -maxdepth 1 -type f -regextype posix-egrep -iregex "\./$without_ext(\.[a-z]{2,3})?\.srt" \
             -exec mv "{}" "$without_ext/" \;
     fi
 }
 
 counter=0
 
-find . -type f -regextype posix-egrep -iregex '.*\.(mkv|mp4)$' -print0 | while IFS= read -r -d '' file; do
+find . -maxdepth 1 -type f -regextype posix-egrep -iregex '.*\.(mkv|mp4)$' -print0 | while IFS= read -r -d '' file; do
     process_file
 done