# Loop through each subdirectory in the directory for folder in */; do # Remove the trailing slash from the folder name folder_name=${folder%/} # Skip if it's not a directory if [ ! -d "$folder_name" ]; then continue fi # Remove zip if it already exists rm -f "$folder_name.zip" # Zip the folder zip -r "$folder_name.zip" "$folder_name" -x "*.DS_Store" done echo "Zipping completed."