Idiomdrottning’s homepage

md, mvd and cpd

I have gotten so much mileage out of these three zsh functions for making directories for over a decade, I should’ve posted them a long time ago but I just didn’t think to.

md () {
	mkdir -p $1
	cd $1
}

mvd () {
	mkdir -p "${@[$#]}"
	mv "$@"
	cd "${@[$#]}"
}

cpd () {
	mkdir -p "${@[$#]}"
	cp -r "$@"
	cd "${@[$#]}"
}