#!/bin/sh # $1 is the remote directory to upload into. # $2 is the local directory to upload from. # $2's name should be ignored, however the # directories within should retain their names. uname="" psswd="" rdir="${1:-/}" dir=${2:-$PWD} url="https://$uname:$psswd@neocities.org/api/upload" # $1 is the directory to upload to. # $2 is everything in the directory to upload from. # $3 is the original name of the directory to upload from, # as that directory name needs to be removed from the start # of each file name. up() { for i in $2 do if [ -d $i ] then up $1 "$i/*" $3 else j=${i#$3/} echo $1/$j curl -F "$1/$j=@$i" "$url" fi done } up $rdir "$dir/*" $dir