Don't try and delete ./target/. (#42680) (cherry-pick to preview) (#42681)

zed-zippy[bot] and Conrad Irwin created

Cherry-pick of #42680 to preview

----
Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>

Change summary

script/clear-target-dir-if-larger-than | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Detailed changes

script/clear-target-dir-if-larger-than 🔗

@@ -21,5 +21,6 @@ echo "target directory size: ${current_size_gb}gb. max size: ${max_size_gb}gb"
 
 if [[ ${current_size_gb} -gt ${max_size_gb} ]]; then
     echo "clearing target directory"
-    rm -rf target/* target/.*
+    shopt -s dotglob
+    rm -rf target/*
 fi