Skip to content

Instantly share code, notes, and snippets.

@kwhitefoot
Created May 20, 2017 20:23
Show Gist options
  • Save kwhitefoot/142be51ea70f4e803277b55556376d88 to your computer and use it in GitHub Desktop.
Save kwhitefoot/142be51ea70f4e803277b55556376d88 to your computer and use it in GitHub Desktop.
Update a neocities site, make the neocities copy have the same files and only the files that are on the local copy.
#!/bin/bash
# Neocities provides an API for uploading to and deleting files from
# your site.
#
# Example Usage:
# $ USERNAME=username PASS=secret_pass bash update_neocities.sh path_to_local_web_root
# or
# $ export USERNAME=username
# $ export PASS=secret_pass
# $ ./update_neocities.sh path_to_local_web_root
# All files that exist on the server but not locally will be removed
# from the server and then all the local files will be uploaded to the
# server.
# From:
# Fail immediately on error
set -e
src=$1
# Change to our directory so that we see our sub-scripts.
# From http://mywiki.wooledge.org/BashFAQ/028
echo "bs: ${BASH_SOURCE%/*}"
cd "${BASH_SOURCE%/*}" || exit
pwd
./delete-not-found-neocities.sh "$src"
./upload-neocities.sh "$src"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment