Created
April 12, 2011 14:16
-
-
Save saml/915559 to your computer and use it in GitHub Desktop.
doesn't really work
This file contains 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 | |
if (( $# < 2 )) | |
then | |
echo "Usage: $0 file-path url [cred]" | |
echo " uploads file-path to url" | |
echo "example, $0 ~/images/foo.jpg http://localhost:4502/content/dam/2010/12/foo.jpg admin:admin" | |
exit 1 | |
fi | |
file_path="$1" | |
url="$2" | |
cred="admin:admin" | |
if (( $# > 2 )) | |
then | |
cred="$3" | |
fi | |
var_path="/var/${url#*/content/}" | |
left="${url%%/content/*}" | |
curl -u "$cred" -T "$file_path" -F "_charset_=utf-8" -F "$var_path@MoveFrom=/tmp/fileupload/file_$(date +%s)" "$left/tmp/fileupload" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment