Skip to content

Instantly share code, notes, and snippets.

@aaroneaton
Last active December 28, 2015 09:59
Show Gist options
  • Save aaroneaton/7483404 to your computer and use it in GitHub Desktop.
Save aaroneaton/7483404 to your computer and use it in GitHub Desktop.
Iterates over the contents of blogs.dir and copies them to wp-content/sites.
#! /bin/bash
shopt -s dotglob
shopt -s nullglob
array=(*/)
echo "Copying ${#array[@]} directories"
for dir in "${array[@]}"; do
# if /uploads/sites doesn't exist, you should create it
cp -r $dir/files ../uploads/sites/$dir
echo "Copied ${dir}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment