Created
September 26, 2024 10:30
-
-
Save shajeen/e1adf8db5b138e20633d09231d81107f to your computer and use it in GitHub Desktop.
compress folder to 7z
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# List all directories in the current folder | |
for dir in */; do | |
# Remove trailing slash from directory name | |
dirname=${dir%/} | |
# Compress the directory using 7zip with maximum compression | |
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on "${dirname}.7z" "$dir" | |
echo "Compressed $dirname" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment