Upload all .gif and .jpg files in a directory to textpattern
This will upload all files in the current directory ending in jpg jpeg or gif through your textpattern-admin panel to your site.
Save this as a shell script, adjust the first 3 variables and excute. (Note: LOGIN and PASS should be ascii only, or else manually url-encoded)
This will not output anything. But after it returns to the prompt, log in to textpattern and take a look into the image section.
Update: Added rudimentary check wether login is successful and basic progress meter.
Save this as a shell script, adjust the first 3 variables and excute. (Note: LOGIN and PASS should be ascii only, or else manually url-encoded)
URL='http://www.mysite.com/textpattern/' LOGIN='simplename' PASS='yourpassword' COOKIE=$(curl -s -D - -d "p_userid=$LOGIN&p_password=$PASS" \ $URL | head -n10 | sed -n 's/^Set\-Cookie\: //p') if [ -z $COOKIE ] then echo "Can't log in." exit 1 else echo "Cookie: "$COOKIE fi for file in $(ls -1|egrep '(gif)|(jpe?g)$') ; do echo "Sending "$file curl -s -H "Cookie: $COOKIE" -F "thefile=@$file" \ -F "event=image" -F "step=image_insert" $URL > /dev/null done
Update: Added rudimentary check wether login is successful and basic progress meter.