Skip to content

Instantly share code, notes, and snippets.

@jonathanbp
Created October 12, 2012 08:14
Show Gist options
  • Save jonathanbp/3877950 to your computer and use it in GitHub Desktop.
Save jonathanbp/3877950 to your computer and use it in GitHub Desktop.
Copying entities from one server to another.
curl "$1/$3?depth=0" | xmllint --format - | grep Id | sed 's/<Id>\(.*\)<\/Id>/\1/' | sort | uniq | tr -s ' ' | sed 's/^ *//g' | while read img_id ; do
curl "$1/$3/$img_id" | xmllint --format - | egrep -v "(Lamport|LastModified)" > tmpimg.xml
curl -X PUT -d @tmpimg.xml "$2/$3/$img_id"
done
@bronsted
Copy link

curl "$1/$3?depth=0" | xmllint --format - | grep Id | sed 's/(.*)</Id>/\1/' | sort | uniq | tr -s ' ' | sed 's/^ *//g' | while read img_id ; do
curl "$1/$3/$img_id" | xmllint --format - | egrep -v "(Lamport|LastModified)" | curl -X PUT -d - "$1/$2/$img_id"
done

@jkiddo
Copy link

jkiddo commented Oct 13, 2012

Sounds fun

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