Skip to content

Instantly share code, notes, and snippets.

@hartsock
Last active August 10, 2017 17:54
Show Gist options
  • Save hartsock/3eabf85a810ad4c15330a45244f408d5 to your computer and use it in GitHub Desktop.
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.
#!/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
@hartsock
Copy link
Author

hartsock commented Aug 10, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment