Skip to content

Instantly share code, notes, and snippets.

@AStupidBear
Created May 6, 2020 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AStupidBear/b383ff6fb0e5545a7f19987526849166 to your computer and use it in GitHub Desktop.
Save AStupidBear/b383ff6fb0e5545a7f19987526849166 to your computer and use it in GitHub Desktop.
#!/bin/bash
args=("$@")
src=${args[$(($#-2))]}
dst=${args[$(($#-1))]}
rsyncopt=${@:1:$#-2}
if [[ ! $dst == *:* ]]; then
mkdir -p $dst
fi
find $src -mindepth 1 -maxdepth 1 | sort -nr | xargs -n 1 -P 10 -I {} bash -c """
name=\$(basename {})
echo $src/\$name '=>' $dst/
rsync $rsyncopt $src/\$name $dst/
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment