blob: 03b656f204bb805692f52c926aeb997cadac4c0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|