Skip to content

Instantly share code, notes, and snippets.

@rchrd2
Created April 5, 2016 01:02
Show Gist options
  • Save rchrd2/4fb3198053d107a81430e35a85a9e363 to your computer and use it in GitHub Desktop.
Save rchrd2/4fb3198053d107a81430e35a85a9e363 to your computer and use it in GitHub Desktop.
Neocities Upload
#!/bin/bash
# Neocities provies an API for uploading files from ./public_html to your site
#
# Example Usage:
# $ USERNAME=username PASS=secret_pass bash upload_site.sh
function upload_file {
fullName=$1
shortName=${fullName:2}
curl -F "$shortName"="@$fullName" https://$USERNAME:$PASS@neocities.org/api/upload
}
cd public_html
find . | while read file; do upload_file "$file"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment