Skip to content

Instantly share code, notes, and snippets.

@alecarg alecarg/mvr.sh
Created Oct 30, 2019

Embed
What would you like to do?
mv recursively (to avoid files not being moved if folders don't exist)
#!/bin/bash
# mv.sh
dir="$2"
tmp="$2"; tmp="${tmp: -1}"
[ "$tmp" != "/" ] && dir="$(dirname "$2")"
[ -a "$dir" ] ||
mkdir -p "$dir" &&
mv "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.