Delete Dot Files
Recursively deletes all hidden (dot) files within a specified directory. Prompts for the directory path before running.
Script
#!/bin/bash
read -p "Enter the directory to start deleting dot files from: " start_dir
if [[ ! -d "$start_dir" ]]; then
echo "Error: Invalid directory. Exiting script."
exit 1
fi
find "$start_dir" -type f -name ".*" -deleteWarning: This permanently deletes all files starting with
.(e.g..gitignore,.env,.bashrc). Make sure you know what you’re deleting.
Last updated on