Last active
December 27, 2019 10:41
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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