summary refs log tree commit diff stats
path: root/various/allup
diff options
context:
space:
mode:
authorkaa <kaa@laptosh.my.domain>2023-06-23 11:19:51 -0700
committerkaa <kaa@laptosh.my.domain>2023-06-23 11:19:51 -0700
commit8828e75a9ee7a5408ad00ad17e9878a2740cc866 (patch)
treebd60b53fb9896316ebc9928a30e0b0806b1c64ae /various/allup
downloadneocities-8828e75a9ee7a5408ad00ad17e9878a2740cc866.tar.gz
"Initial."
Diffstat (limited to 'various/allup')
-rwxr-xr-xvarious/allup33
1 files changed, 33 insertions, 0 deletions
diff --git a/various/allup b/various/allup
new file mode 100755
index 0000000..03b656f
--- /dev/null
+++ b/various/allup
@@ -0,0 +1,33 @@
+#!/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