Skip to content

Instantly share code, notes, and snippets.

@dejurin
Created April 19, 2024 14:13
Show Gist options
  • Save dejurin/e5e16814f9958ea4079f7c947ad600ca to your computer and use it in GitHub Desktop.
Save dejurin/e5e16814f9958ea4079f7c947ad600ca to your computer and use it in GitHub Desktop.
This script creates a zip archive of the current directory, excluding files starting with '.DS_', and names the archive after the current directory.
#!/bin/bash
# Script: create_archive.sh
# Description: This script creates a zip archive of the current directory, excluding files starting with '.DS_', and names the archive after the current directory.
# Assign the name of the current directory to the variable 'folder_name'
folder_name=$(basename "$PWD")
# Find files in the current directory and its subdirectories, excluding those whose names start with '.DS_', and zip them into an archive named after the current directory
find . -type f -not -name '.DS_*' -exec zip "$folder_name.zip" {} +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment