Create a small utility that takes a folder you want to share, and creates a not-obvious URL that you can send to other humans.
- A server you can SSH into
- a *nix machine
Because we are going to make your URL public, let's make it not-obvious so that people can't guess other URLs and steal files:
# make a random string
index=0
str=""
for i in {a..z}; do arr[index]=$i; index=`expr ${index} + 1`; done
for i in {A..Z}; do arr[index]=$i; index=`expr ${index} + 1`; done
for i in {0..9}; do arr[index]=$i; index=`expr ${index} + 1`; done
for i in {1..6}; do str="$str${arr[$RANDOM%$index]}"; done
# compress chosen folder
folder_name=$1
zip_name=$str".zip"
echo "Compressing into" $zip_name
zip -r -X -q $zip_name $1 # -X flag removes junk that Mac OS X adds
# get the login name from some file (assumes you have public-key SSH set up)
login_id=$(<~/.server_id)
# copy to server
scp $zip_name $login_id:/path/to/html/folder/
# copy public link to clipboard
echo $login_id/$zip_name | pbcopy
echo "Link copied to clipboard"
# delete the .zip file we made
rm $zip_name
Download the whole bash script here: