Created
July 12, 2012 18:05
-
-
Save nikoheikkila/3099766 to your computer and use it in GitHub Desktop.
Bash: Bzip2 compress given files in directory
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 | |
# | |
# bzcomp | |
# Bzip2 compress given files in directory | |
# | |
# Example usage: bzcomp logs/ '*.log' 4 | |
# | |
# Author: Niko Heikkilä | |
# Version: 1.0.1 | |
# | |
CWD=$1 # Working directory | |
RULE=$2 # String matching the filename(s) | |
LEVEL=$3 # Compression level {1..9} | |
find "$CWD" -name "$RULE" -exec bzip2 -v"$LEVEL" {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment