bz2 Compress a Folder [Scripts]

I use a ton of bash scripts when I'm working at my Mac or at a Linux workstation. It's time to document these things.

This is a real simple one. It expects a single parameter and it expects that parameter to be a folder name that you'd like to bz2 compress. The tar.bz2 compressed folder is written to the same parent directory as the folder you pass as a parameter.

#!/bin/bash

if [ -d "$1" ]; then
	tar -cjf "${1}.tar.bz2" "$1"
else
	echo "error: expected directory as first parameter"
	echo "useage: $ dirtobz2 path/to/folder"
fi

More to come! I have tons of these things.

Syndicate content