adding inital upload file
This commit is contained in:
commit
5c2b7405ab
1 changed files with 36 additions and 0 deletions
36
plasma_upload.sh
Executable file
36
plasma_upload.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
if [ ! -f "$1" ]; then
|
||||
kdialog --passivepopup "No File!" 5
|
||||
exit
|
||||
fi
|
||||
|
||||
base=${1%.*}
|
||||
baseName=$(basename "$1")
|
||||
ext=${baseName##*.}
|
||||
variable=$(openssl rand -hex 8)
|
||||
remote_path=/var/www/html/images #this is the path the file will be uploaded to
|
||||
|
||||
i=1
|
||||
|
||||
while [ -f "$1" ]
|
||||
do
|
||||
|
||||
rclone moveto "$1" remote:"$remote_path/$variable.$ext" -v --ignore-existing # ignore existing in case the file already exists
|
||||
|
||||
if [ -f "$1" ]; then # if the file is still in /tmp we must've gotten some kind of error, we assume its a Collision
|
||||
kdialog --sorry "Collision $i"
|
||||
i=$((i+1))
|
||||
variable=$(openssl rand -hex 8)
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
if [ "$XDG_SESSION_TYPE" == "x11" ]; then
|
||||
echo "$remote_path/$variable.$ext" | xclip -selection clipboard
|
||||
else
|
||||
wl-copy "$remote_path/$variable.$ext" &> /dev/null
|
||||
fi
|
||||
|
||||
kdialog --passivepopup "Uploaded! $remote_path/$variable.$ext" 5
|
||||
ffplay /usr/share/sounds/freedesktop/stereo/service-login.oga -hide_banner -autoexit -nodisp
|
Loading…
Add table
Reference in a new issue