Skip to content

Instantly share code, notes, and snippets.

@sam
Created June 13, 2012 21:16
Show Gist options
  • Save sam/2926551 to your computer and use it in GitHub Desktop.
Save sam/2926551 to your computer and use it in GitHub Desktop.
Quick and dirty script to copy a list of files from site A to site B
A="example1"
B="example2"
SUM="0"
while read line; do
if [ -f "/nfs/$B/private/$line" ]; then
echo "PATH: $line already exists"
else
line_d="$(dirname "/nfs/$B/private/$line")"
if [ -d $line_d ]; then
echo "DIRECTORY EXISTS: $line_d"
else
echo "CREATING DIRECTORY: $line_d"
sudo mkdir -p $line_d
fi
sudo cp -R /nfs/$A/private/$line /nfs/$B/private/$line
echo "COPYING: $line"
SUM="$(expr "$SUM" + 1)"
fi
done < photos_to_copy.txt
echo
echo "FINISHED COPYING $SUM PHOTOS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment