Skip to content

Instantly share code, notes, and snippets.

@deafmute1
Last active December 27, 2019 10:41
Show Gist options
  • Save deafmute1/04064bdebc51f676df374055e049663d to your computer and use it in GitHub Desktop.
Save deafmute1/04064bdebc51f676df374055e049663d to your computer and use it in GitHub Desktop.
fetches the relative path of files uploaded to webserver in /files (from a remote mount) and sends full URL to clipboard
#!/bin/bash
# takes path to file (on local machine) as argument and uploads it to /files on webserver.
cp "$1" /media/ayew/turnip/var/www/html/files
#outputs the url to clipboard, requires package xclip
path="$(find /media/ayew/turnip/var/www/html/files -type f -printf "%T@ %p\n" | sort -n | tail -n 1 | cut -d' ' -f 2- | sed 's#/media/ayew/turnip/var/www/html/#/#g')"
echo -n "https://ayew.host"$path"" | xclip -selection clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment