You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
409 B

  1. #!/bin/bash
  2. SOURCE=$(realpath "$1")
  3. DEST=$(realpath "$2")
  4. [ ! -d "$SOURCE" ] && echo "SOURCE FOLDER <$SOURCE> not reachable!" && exit 1
  5. [ ! -d "$DEST" ] && echo "DESTINATION FOLDER missing!" && exit 2
  6. [ "$SOURCE" == "$DEST" ] && echo "SOURCE and DESTINATION overriden!" && exit 3
  7. rsync -a --no-inc-recursive --info=progress2 --remove-source-files "$SOURCE" "$DEST" && find "$SOURCE" -type d -empty -delete