Untitled
unknown
sh
a year ago
673 B
12
Indexable
#!/bin/bash path_where_zip_should_be_exexcutet="./../" # Replace with your desired directory and excluded directories directory_to_zip="html" excluded_dirs=("var/cache" "var/log" "public/media") # Create the zip file name zip_file="${directory_to_zip}.zip" # Build the exclude patterns exclude_patterns=() for dir in "${excluded_dirs[@]}"; do exclude_patterns+=("$directory_to_zip/$dir/*") done # Zip the directory with exclusions #-0 means no compression (totally worthless, cause big files like images, videos are already compressed) cd $path_where_zip_should_be_exexcutet && zip -r -0 "$zip_file" "$directory_to_zip" -x "${exclude_patterns[@]}"
Editor is loading...
Leave a Comment