Copy to web
This commit is contained in:
parent
ec4ac1dc69
commit
3a88dd1a64
36
configs/nautilus/scripts/Copy to web
Executable file
36
configs/nautilus/scripts/Copy to web
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
WEBSERVER_PATH=$HOME/www
|
||||||
|
|
||||||
|
# If NAUTILUS_SCRIPT_SELECTED_FILE_PATHS is empty, error and exit
|
||||||
|
if [ -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
|
||||||
|
notify-send "Copy to web" "No local files selected"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For every file in NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
|
||||||
|
echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | while read file; do
|
||||||
|
# Get the last segment of the path
|
||||||
|
filename=$(basename "$file")
|
||||||
|
|
||||||
|
# If the file comes from ~/Pictures/Screenshots, use a path in ~/$WEBSERVER_PATH/screenshots
|
||||||
|
if [[ "$file" == "$HOME/Pictures/Screenshots/"* ]]; then
|
||||||
|
OUTPUT_PATH="$WEBSERVER_PATH/screenshots/$filename"
|
||||||
|
RES_PATH="/screenshots/$filename"
|
||||||
|
mkdir -p "$WEBSERVER_PATH/screenshots"
|
||||||
|
else
|
||||||
|
OUTPUT_PATH="$WEBSERVER_PATH/$filename"
|
||||||
|
RES_PATH="/$filename"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy the file to the webserver
|
||||||
|
cp -r "$file" "$OUTPUT_PATH"
|
||||||
|
|
||||||
|
# Write the resource path to the clipbaord
|
||||||
|
echo -n "$RES_PATH" | xsel -i -b
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# Show a success message
|
||||||
|
notify-send "Copy to web" "Files copied to ~/www"
|
@ -10,6 +10,7 @@
|
|||||||
- ~/projects
|
- ~/projects
|
||||||
- ~/src
|
- ~/src
|
||||||
- ~/www
|
- ~/www
|
||||||
|
- ~/.local/share/nautilus/scripts/
|
||||||
|
|
||||||
- link:
|
- link:
|
||||||
~/.gitconfig: configs/git/.gitconfig
|
~/.gitconfig: configs/git/.gitconfig
|
||||||
@ -28,6 +29,9 @@
|
|||||||
~/bin/fetch-steamdeck-screenshots:
|
~/bin/fetch-steamdeck-screenshots:
|
||||||
path: configs/scripts/fetch-steamdeck-screenshots
|
path: configs/scripts/fetch-steamdeck-screenshots
|
||||||
mode: 755
|
mode: 755
|
||||||
|
~/.local/share/nautilus/scripts/Copy to web:
|
||||||
|
path: configs/nautilus/scripts/Copy to web
|
||||||
|
mode: 755
|
||||||
|
|
||||||
- shell:
|
- shell:
|
||||||
- [git submodule update --init --recursive, Installing submodules]
|
- [git submodule update --init --recursive, Installing submodules]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user