Skip to content

Instantly share code, notes, and snippets.

@marek-saji
Last active April 17, 2017 11:47
Show Gist options
  • Save marek-saji/843dee2059559d1754b79832a8167791 to your computer and use it in GitHub Desktop.
Save marek-saji/843dee2059559d1754b79832a8167791 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
local argv=( "$@" )
local target="${argv[${#argv[@]}-1]}"
unset "argv[${#argv[@]}-1]"
rsync --remove-source-files -PaX "${argv[@]}" "${target}/" \
&& find "${argv[@]}" -empty -type d -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment