Last active
August 10, 2017 17:54
-
-
Save hartsock/3eabf85a810ad4c15330a45244f408d5 to your computer and use it in GitHub Desktop.
A stupid bash script I wrote because I'm not clever enough to not have to write this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SRC=$1 | |
DST=$2 | |
if [[ -z ${SRC} ]]; then echo "No source dir"; exit 1; fi | |
if [[ -z ${DST} ]]; then echo "No destination dir"; exit 1; fi | |
for d in $(ls $SRC); do | |
if [ -d "$SRC/$d" ]; then | |
CMD="rsync -r $SRC/$d/ $DST/$SRC/$d" | |
echo $CMD | |
time `$CMD` | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After an initial copy that looked like:
cp $SRC $DST
Sets up a copy of the first dir at the second location, this thing then syncs the sub directories omitting "hidden" directories.
I put the timing info into the command so I could figure out which dirs were going to be trouble.